#include <vector.h>
A color consisting of three components R, G, B and an alpha.
Public Types | |
template<typename U > | |
using | Rebind = Col4< U, STRIDE > |
using | VectorStrideType = std::integral_constant< Int, STRIDE > |
using | ValueType = T |
using | ValueTypeParam = typename ByValueParam< T >::type |
using | Unstrided = Col4< T, 1 > |
using | BoolType = decltype(T()==T()) |
Public Member Functions | |
Col4 () | |
Col4 (ValueTypeParam in) | |
Col4 (ValueTypeParam ix, ValueTypeParam iy, ValueTypeParam iz, ValueTypeParam iw) | |
template<typename T2 , Int S2> | |
Col4 (const Col4< T2, S2 > &v) | |
template<typename T2 , Int S2> | |
Col4 (const Vec4< T2, S2 > &v) | |
template<Int S2> | |
Col4 (const Col4< T, S2 > &v) | |
template<typename T2 , Int S2> | |
Col4 (const Col3< T2, S2 > &v, T iw=T(1)) | |
Col4 (ENUM_DONT_INITIALIZE v) | |
const Vec4< T, STRIDE > & | GetVector () const |
Vec4< T, STRIDE > & | GetVector () |
const Col3< T, STRIDE > & | GetColor3 () const |
MAXON_IMPLICIT | Col4 (const typename std::conditional< STRIDE==1, DummyParamType, Col4 >::type &src) |
Col4 & | operator= (const typename std::conditional< STRIDE==1, DummyParamType, Col4 >::type &src) |
T & | operator[] (Int l) |
ValueTypeParam | operator[] (Int l) const |
template<typename T2 , Int S2> | |
Col4 & | operator+= (const Col4< T2, S2 > &v) |
Col4 & | operator+= (const Col4 &v) |
template<typename T2 , Int S2> | |
Col4 & | operator-= (const Col4< T2, S2 > &v) |
Col4 & | operator-= (const Col4 &v) |
template<typename T2 , Int S2> | |
Col4 & | operator*= (const Col4< T2, S2 > &v) |
Col4 & | operator*= (const Col4 &v) |
Col4 & | operator*= (ValueTypeParam s) |
Col4 & | operator/= (ValueTypeParam s) |
Unstrided | operator* (ValueTypeParam s) const |
template<typename S > | |
Col4< typename MultiplicativePromotion< T, S, std::is_scalar< S >::value >::type, 1 > | operator* (S s) const |
Unstrided | operator/ (ValueTypeParam s) const |
Unstrided | operator* (const Col4 &v) const |
Unstrided | operator+ (const Col4 &v) const |
Unstrided | operator- (const Col4 &v) const |
Unstrided | operator- () const |
template<typename T2 , Int S2> | |
BoolType | operator== (const Col4< T2, S2 > &v) const |
BoolType | operator== (const Col4 &v) const |
template<typename T2 , Int S2> | |
BoolType | operator!= (const Col4< T2, S2 > &v) const |
BoolType | operator!= (const Col4 &v) const |
BoolType | LessThanOrEqual (const Col4 &v) const |
UInt | GetHashCode () const |
BoolType | IsEqual (const Col4 &other, ValueTypeParam epsilon) const |
BoolType | IsZero () const |
void | SetZero () |
T | GetAverage () const |
T | GetSum () const |
void | ClampMin (const Col4 &other=Col4()) |
void | ClampMax (const Col4 &other) |
Unstrided | Clamp01 () const |
String | ToString (const FormatStatement *formatStatement) const |
T | GetMin () const |
T | GetMax () const |
Col4 | GetRightRotated (Int rots) const |
template<typename V > | |
Col4 & | operator*= (const SqMat4< V > &m) |
Static Public Member Functions | |
static const Col4 & | NullValue () |
Public Attributes | |
union { | |
T r | |
T _xpadding [STRIDE] | |
}; | |
union { | |
T g | |
T _ypadding [STRIDE] | |
}; | |
union { | |
T b | |
T _zpadding [STRIDE] | |
}; | |
union { | |
T a | |
T _wpadding [STRIDE] | |
}; | |
Friends | |
Unstrided | operator* (ValueTypeParam s, const Col4 &v) |
T | Dot (const Col4 &v1, const Col4 &v2) |
Unstrided | Abs (const Col4 &v1) |
template<typename T2 , Int S2> | |
MultiplicativePromotion< T, T2 >::type | Dot (const Col4 &v1, const Col4< T2, S2 > &v2) |
Unstrided | Min (const Col4 &th, const Col4 &other) |
Unstrided | Max (const Col4 &th, const Col4 &other) |
void | SetMin (Col4 &th, const Col4 &other) |
void | SetMax (Col4 &th, const Col4 &other) |
using VectorStrideType = std::integral_constant<Int, STRIDE> |
using ValueType = T |
using ValueTypeParam = typename ByValueParam<T>::type |
using BoolType = decltype(T() == T()) |
The type returned by comparisons. If the template argument for T is a SIMD type, this will be a SIMD type, too, which contains the per-element results.
Col4 | ( | ) |
Initializes all color components with 0.0 and the alpha with 1.0.
|
explicit |
Initializes all color components with a scalar and the alpha with 1.0.
|
explicit |
Initializes all vector components individually.
Initializes components from a 3d vector and add an additional value for the a-component. The default value for the alpha is 1.0.
|
explicit |
Skips initialization of vector (for better speed)
MAXON_IMPLICIT Col4 | ( | const typename std::conditional< STRIDE==1, DummyParamType, Col4< T, STRIDE > >::type & | src | ) |
Col4& operator= | ( | const typename std::conditional< STRIDE==1, DummyParamType, Col4< T, STRIDE > >::type & | src | ) |
T& operator[] | ( | Int | l | ) |
Accesses vector component: index 0 is 'r', index 1 is 'g', index 2 is 'b'. All other values must not be used and will crash.
ValueTypeParam operator[] | ( | Int | l | ) | const |
Accesses vector component: index 0 is 'r', index 1 is 'g', index 2 is 'b'. All other values must not be used and will crash.
Col4& operator*= | ( | ValueTypeParam | s | ) |
Multiplies each vector component by a scalar.
Col4& operator/= | ( | ValueTypeParam | s | ) |
Divides each vector component by a scalar. The passed argument is checked for 0.0.
Unstrided operator* | ( | ValueTypeParam | s | ) | const |
Multiplies each vector component by a scalar.
Col4<typename MultiplicativePromotion<T, S, std::is_scalar<S>::value>::type, 1> operator* | ( | S | s | ) | const |
Multiplies each vector component by a scalar.
Unstrided operator/ | ( | ValueTypeParam | s | ) | const |
Divides each vector component by a scalar. The scalar value is tested for 0.0.
Unstrided operator- | ( | ) | const |
Negates vector v.
UInt GetHashCode | ( | ) | const |
BoolType IsEqual | ( | const Col4< T, STRIDE > & | other, |
ValueTypeParam | epsilon | ||
) | const |
Tests component-wise if the difference is no bigger than 'epsilon'.
BoolType IsZero | ( | ) | const |
Checks if each component is zero.
void SetZero | ( | ) |
Sets all components to zero.
T GetAverage | ( | ) | const |
Calculates the average value of 'r', 'g', 'b' and 'a'.
T GetSum | ( | ) | const |
Calculates the sum of 'r', 'g', 'b' and 'a'.
Set the minimum of each component.
Unstrided Clamp01 | ( | ) | const |
Returns a vector that is clamped to the range [0.0 .. 1.0].
String ToString | ( | const FormatStatement * | formatStatement | ) | const |
Returns a readable string of the content.
[in] | formatStatement | Nullptr or additional formatting instruction. See also format_float. |
T GetMin | ( | void | ) | const |
Returns the minimum of 'r', 'g', 'b' and 'a'.
T GetMax | ( | void | ) | const |
Returns the maximum of 'r', 'g', 'b' and 'a'.
Returns a vector where the components have been rotated to the right (in the usual (r, g, b, a)-representation). E.g., with a value of 1 for rots, the result will be (a, r, g, b).
[in] | rots | Number of rotations, may be negative. The result depends only on the number modulo 4. |
|
static |
|
friend |
Multiplies each vector component by a scalar.
Calculates dot product of v1 and v2.
Returns the vector with absolute value for each entry
[in] | v1 | input vector to work on |
|
friend |
Calculates dot product of v1 and v2.
Calculates the minimum of each component.
Calculates the maximum of each component.
Set the minimum of each component.
Set the maximum of each component.
T r |
T _xpadding[STRIDE] |
union { ... } |
T g |
T _ypadding[STRIDE] |
union { ... } |
T b |
T _zpadding[STRIDE] |
union { ... } |
T a |
T _wpadding[STRIDE] |
union { ... } |