FdkBaseLib 2.1.1
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
fdk::Vec4< T > Class Template Reference

#include <Vec4.h>

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = const T &
 

Public Member Functions

 Vec4 ()=default
 Default constructor leaves garbage in contents.
 
template<typename S >
 Vec4 (const Vec4< S > &b)
 Copy constructor supports type conversion.
 
template<typename S >
 Vec4 (S a)
 Constructor that sets all components to a single value.
 
 Vec4 (T a, T b)
 Constructors that set separate components with defaults z=0 and w=1.
 
 Vec4 (T a, T b, T c)
 
 Vec4 (T a, T b, T c, T d)
 
template<typename S >
 Vec4 (S *v)
 Constructor from an array of 4 numbers.
 
template<typename S >
 Vec4 (const S *v)
 
template<typename S >
 Vec4 (const Vec2< S > &v)
 
template<typename S >
 Vec4 (const Vec2< S > &v, T vz, T vw=static_cast< T >(1))
 
template<typename S >
 Vec4 (const Vec3< S > &v)
 
template<typename S >
 Vec4 (const Vec3< S > &v, T vw)
 
 operator Vec4< fdk::half > () const
 Returns value as a specific type:
 
 operator Vec4< float > () const
 
 operator Vec4< double > () const
 
 operator Vec4< int > () const
 
Vec4< fdk::halfasVec4h () const
 
Vec4< float > asVec4f () const
 
Vec4< double > asVec4d () const
 
Vec4< int > asVec4i () const
 
T & operator[] (int n)
 
const T & operator[] (int n) const
 
T * array ()
 Returns a pointer to the first element.
 
const T * array () const
 
Vec2< T > xy () const
 
Vec3< T > xyz () const
 
void set (T d)
 Set xyz to a single value and w to 1.
 
void set (T a, T b, T c, T d=static_cast< T >(1))
 Set all components, w defaults to 1.
 
void set (const Vec3< T > &v, T vw=static_cast< T >(1))
 Set xyz and w separately.
 
void setToZero ()
 Set components to 0.
 
void setToOne ()
 Set components to 1.
 
void clear ()
 Type-specific clear. Set xyz to 0 and w to 1.
 
void append (fdk::Hash &hash) const
 Add this to a fdk::Hash object.
 
template<typename S >
Vec4 operator* (const Mat4< S > &m) const
 
template<typename S >
Vec4operator*= (const Mat4< S > &m)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4 operator* (S d) const
 
Vec4 operator* (const Vec4 &v) const
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4operator*= (S d)
 
Vec4operator*= (const Vec4 &v)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4 operator/ (S d) const
 
Vec4 operator/ (const Vec4 &v) const
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4operator/= (S d)
 
Vec4operator/= (const Vec4 &v)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4 operator+ (S d) const
 
Vec4 operator+ (const Vec4 &v) const
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4operator+= (S d)
 
Vec4operator+= (const Vec4 &v)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4 operator- (S d) const
 
Vec4 operator- (const Vec4 &v) const
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true>
Vec4operator-= (S d)
 
Vec4operator-= (const Vec4 &v)
 
Vec4 operator- () const
 
void negate ()
 
bool operator== (const Vec4 &v) const
 
bool operator!= (const Vec4 &v) const
 
bool operator== (T d) const
 
bool operator!= (T d) const
 
bool operator< (const Vec4 &v) const
 Fairly arbitrary operator so you can store these in ordered arrays.
 
Vec4wNormalize ()
 Divide x, y, and z by w. If w is zero, the behaviour is undefined.
 
Vec3< T > wNormalized () const
 
Vec3< T > wTruncate () const
 Trims off w, same as xyz() method.
 
minimumComponent () const
 Returns the minimum XYZ element - w is ignored.
 
Vec4 minimum (const Vec4 &v) const
 
maximumComponent () const
 Returns the maximum XYZ element - w is ignored.
 
Vec4 maximum (const Vec4 &v) const
 
largestAxis () const
 Returns the absolute value of the largest XYZ element - w is ignored.
 
template<typename S >
Vec4< T > interpolateTo (const Vec4< T > &b, S t) const
 Linear-interpolate between this Vec4 and another at t, where t=0..1.
 
Vec4 inverted () const
 
template<typename S >
Vec4< T > lerpClampedTo (const Vec4< T > &b, S t) const
 
template<typename S >
Vec4< T > lerpUnclampedTo (const Vec4< T > &b, S t) const
 
template<typename S >
Vec4 clamped (S min, S max) const
 
Vec4 clamped () const
 
bool isZero () const
 
bool notZero () const
 
bool greaterThanZero () const
 
template<typename S >
Vec4< T > operator* (const Mat4< S > &m) const
 
template<typename S >
Vec4< T > & operator*= (const Mat4< S > &m)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > >
Vec4< T > & operator*= (S d)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > >
Vec4< T > & operator/= (S d)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > >
Vec4< T > & operator+= (S d)
 
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > >
Vec4< T > & operator-= (S d)
 

Public Attributes

x
 
y
 
z
 
w
 the data
 

Static Public Attributes

static constexpr uint8_t kNumElements = 4
 
static constexpr uint8_t X = 0
 
static constexpr uint8_t Y = 1
 
static constexpr uint8_t Z = 2
 
static constexpr uint8_t W = 3
 
static const Vec4 XAxis
 
static const Vec4 YAxis
 
static const Vec4 ZAxis
 
static const Vec4 WAxis
 

Detailed Description

template<typename T>
class fdk::Vec4< T >

4-component vector



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com