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