Path: blob/master/thirdparty/embree/common/math/col4.h
9912 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "emath.h"67namespace embree8{9////////////////////////////////////////////////////////////////////////////////10/// RGBA Color Class11////////////////////////////////////////////////////////////////////////////////1213template<typename T> struct Col414{15T r, g, b, a;1617////////////////////////////////////////////////////////////////////////////////18/// Construction19////////////////////////////////////////////////////////////////////////////////2021__forceinline Col4 ( ) { }22__forceinline Col4 ( const Col4& other ) { r = other.r; g = other.g; b = other.b; a = other.a; }23__forceinline Col4& operator=( const Col4& other ) { r = other.r; g = other.g; b = other.b; a = other.a; return *this; }2425__forceinline explicit Col4 (const T& v) : r(v), g(v), b(v), a(v) {}26__forceinline Col4 (const T& r, const T& g, const T& b, const T& a) : r(r), g(g), b(b), a(a) {}2728////////////////////////////////////////////////////////////////////////////////29/// Constants30////////////////////////////////////////////////////////////////////////////////3132__forceinline Col4 (ZeroTy) : r(zero) , g(zero) , b(zero) , a(zero) {}33__forceinline Col4 (OneTy) : r(one) , g(one) , b(one) , a(one) {}34__forceinline Col4 (PosInfTy) : r(pos_inf), g(pos_inf), b(pos_inf), a(pos_inf) {}35__forceinline Col4 (NegInfTy) : r(neg_inf), g(neg_inf), b(neg_inf), a(neg_inf) {}36};3738/*! output operator */39template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Col4<T>& a) {40return cout << "(" << a.r << ", " << a.g << ", " << a.b << ", " << a.a << ")";41}4243/*! default template instantiations */44typedef Col4<unsigned char> Col4uc;45typedef Col4<float > Col4f;46}474849