Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/embree/common/math/col3.h
9912 views
1
// Copyright 2009-2021 Intel Corporation
2
// SPDX-License-Identifier: Apache-2.0
3
4
#pragma once
5
6
#include "emath.h"
7
8
namespace embree
9
{
10
////////////////////////////////////////////////////////////////////////////////
11
/// RGB Color Class
12
////////////////////////////////////////////////////////////////////////////////
13
14
template<typename T> struct Col3
15
{
16
T r, g, b;
17
18
////////////////////////////////////////////////////////////////////////////////
19
/// Construction
20
////////////////////////////////////////////////////////////////////////////////
21
22
__forceinline Col3 ( ) { }
23
__forceinline Col3 ( const Col3& other ) { r = other.r; g = other.g; b = other.b; }
24
__forceinline Col3& operator=( const Col3& other ) { r = other.r; g = other.g; b = other.b; return *this; }
25
26
__forceinline explicit Col3 (const T& v) : r(v), g(v), b(v) {}
27
__forceinline Col3 (const T& r, const T& g, const T& b) : r(r), g(g), b(b) {}
28
29
////////////////////////////////////////////////////////////////////////////////
30
/// Constants
31
////////////////////////////////////////////////////////////////////////////////
32
33
__forceinline Col3 (ZeroTy) : r(zero) , g(zero) , b(zero) {}
34
__forceinline Col3 (OneTy) : r(one) , g(one) , b(one) {}
35
__forceinline Col3 (PosInfTy) : r(pos_inf), g(pos_inf), b(pos_inf) {}
36
__forceinline Col3 (NegInfTy) : r(neg_inf), g(neg_inf), b(neg_inf) {}
37
};
38
39
/*! output operator */
40
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Col3<T>& a) {
41
return cout << "(" << a.r << ", " << a.g << ", " << a.b << ")";
42
}
43
44
/*! default template instantiations */
45
typedef Col3<unsigned char> Col3uc;
46
typedef Col3<float > Col3f;
47
}
48
49