HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
tt::i32x4 Class Reference

#include <ttauri/ivec.hpp>

Public Member Functions

 i32x4 (i32x4 const &rhs)=default
 
i32x4operator= (i32x4 const &rhs)=default
 
 i32x4 (i32x4 &&rhs)=default
 
i32x4operator= (i32x4 &&rhs)=default
 
 i32x4 (__m128i rhs) noexcept
 Create a i32x4 out of a __m128i.
 
i32x4operator= (__m128i rhs) noexcept
 Create a i32x4 out of a __m128i.
 
 operator __m128i () const noexcept
 Convert a i32x4 to a __m128i.
 
 i32x4 (f32x4 const &rhs) noexcept
 
i32x4operator= (f32x4 const &rhs) noexcept
 
 operator f32x4 () const noexcept
 
 operator std::array< int32_t, 4 > () const noexcept
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
 i32x4 (T rhs) noexcept
 Initialize a i32x4 with all elements set to a value.
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4operator= (T rhs) noexcept
 Initialize a i32x4 with all elements set to a value.
 
template<typename T , typename U , typename V = int, typename W = int, std::enable_if_t< std::is_arithmetic_v< T > &&std::is_arithmetic_v< U > &&std::is_arithmetic_v< V > &&std::is_arithmetic_v< W >, int > = 0>
 i32x4 (T x, U y, V z=0, W w=0) noexcept
 Create a i32x4 out of 2 to 4 values.
 
template<size_t I, typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4set (T rhs) noexcept
 
template<size_t I>
int get () const noexcept
 
constexpr size_t size () const noexcept
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4x (T rhs) noexcept
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4y (T rhs) noexcept
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4z (T rhs) noexcept
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4w (T rhs) noexcept
 
int x () const noexcept
 
int y () const noexcept
 
int z () const noexcept
 
int w () const noexcept
 
int width () const noexcept
 
int height () const noexcept
 
i32x4operator+= (i32x4 const &rhs) noexcept
 
i32x4operator-= (i32x4 const &rhs) noexcept
 
i32x4operator*= (i32x4 const &rhs) noexcept
 
template<char a, char b, char c, char d>
i32x4 swizzle () const noexcept
 

Static Public Member Functions

template<typename T , typename U , typename V = int, typename W = int, std::enable_if_t< std::is_arithmetic_v< T > &&std::is_arithmetic_v< U > &&std::is_arithmetic_v< V > &&std::is_arithmetic_v< W >, int > = 0>
static i32x4 point (T x, U y, V z=0, W w=1) noexcept
 Create a i32x4 out of 2 to 4 values.
 
template<char a, char b, char c, char d>
static constexpr int swizzle_permute_mask () noexcept
 

Friends

i32x4 operator+ (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
i32x4 operator- (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
i32x4 operator* (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
i32x4 max (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
i32x4 min (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
bool operator== (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
bool operator!= (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
int eq (i32x4 const &lhs, i32x4 const &rhs) noexcept
 Equal to.
 
int operator< (i32x4 const &lhs, i32x4 const &rhs) noexcept
 Less than.
 
int operator> (i32x4 const &lhs, i32x4 const &rhs) noexcept
 Greater than.
 
int operator<= (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
int operator>= (i32x4 const &lhs, i32x4 const &rhs) noexcept
 
std::string to_string (i32x4 const &rhs) noexcept
 
std::ostream friend & operator<< (std::ostream &lhs, i32x4 const &rhs) noexcept
 
template<std::size_t I>
int get (i32x4 const &rhs) noexcept
 

Detailed Description

A 4D vector.

If you need a 3D vector or point, 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 f32x4, the third and forth element will default to '0' and 'w'. This allows a 2D vector to maintain its homogeniousness.

Constructor & Destructor Documentation

◆ i32x4() [1/3]

tt::i32x4::i32x4 ( __m128i rhs)
inlinenoexcept

Create a i32x4 out of a __m128i.

◆ i32x4() [2/3]

template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
tt::i32x4::i32x4 ( T rhs)
inlineexplicitnoexcept

Initialize a i32x4 with all elements set to a value.

Useful as a scalar converter, when combined with an arithmetic operator.

◆ i32x4() [3/3]

template<typename T , typename U , typename V = int, typename W = int, std::enable_if_t< std::is_arithmetic_v< T > &&std::is_arithmetic_v< U > &&std::is_arithmetic_v< V > &&std::is_arithmetic_v< W >, int > = 0>
tt::i32x4::i32x4 ( T x,
U y,
V z = 0,
W w = 0 )
inlinenoexcept

Create a i32x4 out of 2 to 4 values.

This vector is used as a homogeneous coordinate, meaning:

  • vectors have w=0 (A direction and distance)
  • points have w=1 (A position in space)

Member Function Documentation

◆ operator __m128i()

tt::i32x4::operator __m128i ( ) const
inlinenoexcept

Convert a i32x4 to a __m128i.

◆ operator=() [1/2]

i32x4 & tt::i32x4::operator= ( __m128i rhs)
inlinenoexcept

Create a i32x4 out of a __m128i.

◆ operator=() [2/2]

template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0>
i32x4 & tt::i32x4::operator= ( T rhs)
inlinenoexcept

Initialize a i32x4 with all elements set to a value.

Useful as a scalar converter, when combined with an arithmetic operator.

◆ point()

template<typename T , typename U , typename V = int, typename W = int, std::enable_if_t< std::is_arithmetic_v< T > &&std::is_arithmetic_v< U > &&std::is_arithmetic_v< V > &&std::is_arithmetic_v< W >, int > = 0>
static i32x4 tt::i32x4::point ( T x,
U y,
V z = 0,
W w = 1 )
inlinestaticnoexcept

Create a i32x4 out of 2 to 4 values.

This vector is used as a homogeneous coordinate, meaning:

  • vectors have w=0 (A direction and distance)
  • points have w=1 (A position in space)

Friends And Related Symbol Documentation

◆ eq

int eq ( i32x4 const & lhs,
i32x4 const & rhs )
friend

Equal to.

Returns
boolean nibble field, bit [3:0]=x, [7:4]=y, [11:8]=z, [15:12]=w.

◆ operator<

int operator< ( i32x4 const & lhs,
i32x4 const & rhs )
friend

Less than.

Returns
boolean nibble field, bit [3:0]=x, [7:4]=y, [11:8]=z, [15:12]=w.

◆ operator>

int operator> ( i32x4 const & lhs,
i32x4 const & rhs )
friend

Greater than.

Returns
boolean nibble field, bit [3:0]=x, [7:4]=y, [11:8]=z, [15:12]=w.

The documentation for this class was generated from the following file: