10 #ifndef INCLUDED_ATOMSMATHCOLOR_H
11 #define INCLUDED_ATOMSMATHCOLOR_H
13 #include <AtomsMath/ImathNamespace.h>
14 #include <AtomsMath/ImathVec.h>
15 #include <AtomsMath/half.h>
17 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_ENTER
36 ATOMSMATH_HOSTDEVICE
Color3() noexcept;
39 ATOMSMATH_HOSTDEVICE constexpr
explicit Color3 (T a) noexcept;
42 ATOMSMATH_HOSTDEVICE constexpr
Color3 (T a, T b, T c) noexcept;
45 ATOMSMATH_HOSTDEVICE constexpr
Color3 (
const Color3& c) noexcept;
48 template <
class S> ATOMSMATH_HOSTDEVICE constexpr
Color3 (
const Vec3<S>& v) noexcept;
77 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color3&
negate() noexcept;
80 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color3& operator*= (const
Color3& c) noexcept;
83 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color3& operator*= (T a) noexcept;
86 ATOMSMATH_HOSTDEVICE constexpr
Color3 operator* (const
Color3& c) const noexcept;
89 ATOMSMATH_HOSTDEVICE constexpr
Color3 operator* (T a) const noexcept;
92 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color3& operator/= (const
Color3& c) noexcept;
95 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color3& operator/= (T a) noexcept;
98 ATOMSMATH_HOSTDEVICE constexpr
Color3 operator/ (const
Color3& c) const noexcept;
101 ATOMSMATH_HOSTDEVICE constexpr
Color3 operator/ (T a) const noexcept;
129 ATOMSMATH_HOSTDEVICE
Color4() noexcept;
132 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
explicit Color4 (T a) noexcept;
135 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Color4 (T a, T b, T c, T d) noexcept;
138 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Color4 (
const Color4& v) noexcept;
141 template <
class S> ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Color4 (
const Color4<S>& v) noexcept;
150 ATOMSMATH_HOSTDEVICE T&
operator[] (
int i) noexcept;
153 ATOMSMATH_HOSTDEVICE
const T&
operator[] (
int i)
const noexcept;
182 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color4&
negate() noexcept;
185 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color4& operator*= (const
Color4& v) noexcept;
188 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color4& operator*= (T a) noexcept;
191 ATOMSMATH_HOSTDEVICE constexpr
Color4 operator* (const
Color4& v) const noexcept;
194 ATOMSMATH_HOSTDEVICE constexpr
Color4 operator* (T a) const noexcept;
197 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color4& operator/= (const
Color4& v) noexcept;
200 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const
Color4& operator/= (T a) noexcept;
203 ATOMSMATH_HOSTDEVICE constexpr
Color4 operator/ (const
Color4& v) const noexcept;
206 ATOMSMATH_HOSTDEVICE constexpr
Color4 operator/ (T a) const noexcept;
214 ATOMSMATH_HOSTDEVICE constexpr static
unsigned int dimensions() noexcept {
return 4; }
217 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeLowest() noexcept {
return std::numeric_limits<T>::lowest(); }
220 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeMax() noexcept {
return std::numeric_limits<T>::max(); }
223 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeSmallest() noexcept {
return std::numeric_limits<T>::min(); }
226 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeEpsilon() noexcept {
return std::numeric_limits<T>::epsilon(); }
238 template <
class S> ATOMSMATH_HOSTDEVICE
void setValue (S a, S b, S c, S d) noexcept;
244 template <
class S> ATOMSMATH_HOSTDEVICE
void getValue (S& a, S& b, S& c, S& d)
const noexcept;
250 ATOMSMATH_HOSTDEVICE T*
getValue() noexcept;
253 ATOMSMATH_HOSTDEVICE const T*
getValue() const noexcept;
259 template <class T> std::ostream& operator<< (std::ostream& s, const
Color4<T>& v);
262 template <class S, class T> constexpr
Color4<T> operator* (S a, const
Color4<T>& v) noexcept;
301 typedef
unsigned int PackedColor;
335 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
343 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
358 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
380 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
388 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
396 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
418 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
426 ATOMSMATH_CONSTEXPR14
inline const Color3<T>&
502 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
567 return (
const T*) &r;
572 constexpr
inline bool
575 return r == v.r && g == v.g && b == v.b && a == v.a;
580 constexpr
inline bool
583 return r != v.r || g != v.g || b != v.b || a != v.a;
587 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
601 return Color4 (r + v.r, g + v.g, b + v.b, a + v.a);
605 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
619 return Color4 (r - v.r, g - v.g, b - v.b, a - v.a);
626 return Color4 (-r, -g, -b, -a);
630 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
641 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
652 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
666 return Color4 (r * v.r, g * v.g, b * v.b, a * v.a);
673 return Color4 (r * x, g * x, b * x, a * x);
677 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
688 ATOMSMATH_CONSTEXPR14
inline const Color4<T>&
702 return Color4 (r / v.r, g / v.g, b / v.b, a / v.a);
709 return Color4 (r / x, g / x, b / x, a / x);
714 operator<< (std::ostream& s,
const Color4<T>& v)
716 return s <<
'(' << v.r <<
' ' << v.g <<
' ' << v.b <<
' ' << v.a <<
')';
723 template <
class S,
class T>
727 return Color4<T> (x * v.r, x * v.g, x * v.b, x * v.a);
730 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImathColor.h:29
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & operator/=(const Color3 &c) noexcept
Component-wise division.
Definition: ImathColor.h:419
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & negate() noexcept
Component-wise multiplication by -1.
Definition: ImathColor.h:381
constexpr ATOMSMATH_HOSTDEVICE Color3 operator-() const noexcept
Component-wise multiplication by -1.
Definition: ImathColor.h:374
~Color3()=default
Destructor.
constexpr ATOMSMATH_HOSTDEVICE Color3 operator+(const Color3 &c) const noexcept
Component-wise addition.
Definition: ImathColor.h:352
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & operator+=(const Color3 &c) noexcept
Component-wise addition.
Definition: ImathColor.h:344
constexpr ATOMSMATH_HOSTDEVICE Color3 operator/(const Color3 &c) const noexcept
Component-wise division.
Definition: ImathColor.h:435
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & operator*=(const Color3 &c) noexcept
Component-wise multiplication.
Definition: ImathColor.h:389
constexpr ATOMSMATH_HOSTDEVICE Color3 operator*(const Color3 &c) const noexcept
Component-wise multiplication.
Definition: ImathColor.h:405
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & operator-=(const Color3 &c) noexcept
Component-wise subtraction.
Definition: ImathColor.h:359
constexpr ATOMSMATH_HOSTDEVICE Color3(const Vec3< S > &v) noexcept
Construct from Vec3.
ATOMSMATH_HOSTDEVICE Color3() noexcept
No initialization by default.
Definition: ImathColor.h:307
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color3 & operator=(const Color3 &c) noexcept
Component-wise assignment.
Definition: ImathColor.h:336
Definition: ImathColor.h:115
~Color4()=default
Destructor.
constexpr ATOMSMATH_HOSTDEVICE Color4 operator/(const Color4 &v) const noexcept
Component-wise division.
Definition: ImathColor.h:700
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & operator-=(const Color4 &v) noexcept
Component-wise subtraction.
Definition: ImathColor.h:606
T BaseType
Definition: ImathColor.h:232
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeLowest() noexcept
Largest possible negative value.
Definition: ImathColor.h:217
ATOMSMATH_HOSTDEVICE void setValue(S a, S b, S c, S d) noexcept
Set the value.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & operator=(const Color4 &v) noexcept
Assignment.
Definition: ImathColor.h:503
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & operator/=(const Color4 &v) noexcept
Component-wise division.
Definition: ImathColor.h:678
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & operator*=(const Color4 &v) noexcept
Component-wise multiplication.
Definition: ImathColor.h:642
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeEpsilon() noexcept
Smallest possible e for which 1+e != 1.
Definition: ImathColor.h:226
constexpr ATOMSMATH_HOSTDEVICE bool operator==(const Color4< S > &v) const noexcept
Equality.
ATOMSMATH_HOSTDEVICE T & operator[](int i) noexcept
Component-wise value.
Definition: ImathColor.h:453
constexpr ATOMSMATH_HOSTDEVICE Color4 operator-() const noexcept
Component-wise multiplication by -1.
Definition: ImathColor.h:624
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & negate() noexcept
Component-wise multiplication by -1.
Definition: ImathColor.h:631
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Color4(const Color4< S > &v) noexcept
Construct from Color4.
constexpr ATOMSMATH_HOSTDEVICE bool operator!=(const Color4< S > &v) const noexcept
Inequality.
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeMax() noexcept
Largest possible positive value.
Definition: ImathColor.h:220
ATOMSMATH_HOSTDEVICE void getValue(S &a, S &b, S &c, S &d) const noexcept
Return the value.
ATOMSMATH_HOSTDEVICE void getValue(Color4< S > &v) const noexcept
Return the value.
ATOMSMATH_HOSTDEVICE void setValue(const Color4< S > &v) noexcept
Set the value.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Color4 & operator+=(const Color4 &v) noexcept
Component-wise addition.
Definition: ImathColor.h:588
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeSmallest() noexcept
Smallest possible positive value.
Definition: ImathColor.h:223
constexpr ATOMSMATH_HOSTDEVICE Color4 operator+(const Color4 &v) const noexcept
Component-wise addition.
Definition: ImathColor.h:599
ATOMSMATH_HOSTDEVICE T * getValue() noexcept
Return raw pointer to the value.
Definition: ImathColor.h:558
ATOMSMATH_HOSTDEVICE Color4() noexcept
No initialization by default.
Definition: ImathColor.h:465
constexpr ATOMSMATH_HOSTDEVICE Color4 operator*(const Color4 &v) const noexcept
Component-wise multiplication.
Definition: ImathColor.h:664
Definition: ImathVec.h:260
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T & operator[](int i) noexcept
Element access by index.
Definition: ImathVec.h:1199
ATOMSMATH_HOSTDEVICE T * getValue() noexcept
Return a raw pointer to the array of values.
Definition: ImathVec.h:1318
constexpr ATOMSMATH_HOSTDEVICE bool operator==(const Vec3< S > &v) const noexcept
Equality.
constexpr ATOMSMATH_HOSTDEVICE bool operator!=(const Vec3< S > &v) const noexcept
Inequality.
constexpr static ATOMSMATH_HOSTDEVICE unsigned int dimensions() noexcept
Return the number of dimensions, i.e. 3.
Definition: ImathVec.h:471