GraphicsAPI_2020C
color4.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2017, assimp team
7 
8 
9 All rights reserved.
10 
11 Redistribution and use of this software in source and binary forms,
12 with or without modification, are permitted provided that the following
13 conditions are met:
14 
15 * Redistributions of source code must retain the above
16  copyright notice, this list of conditions and the
17  following disclaimer.
18 
19 * Redistributions in binary form must reproduce the above
20  copyright notice, this list of conditions and the
21  following disclaimer in the documentation and/or other
22  materials provided with the distribution.
23 
24 * Neither the name of the assimp team, nor the names of its
25  contributors may be used to endorse or promote products
26  derived from this software without specific prior
27  written permission of the assimp team.
28 
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 ---------------------------------------------------------------------------
41 */
45 #pragma once
46 #ifndef AI_COLOR4D_H_INC
47 #define AI_COLOR4D_H_INC
48 
49 #include "defs.h"
50 
51 #ifdef __cplusplus
52 
53 // ----------------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------------
57 template <typename TReal>
58 class aiColor4t
59 {
60 public:
61  aiColor4t () : r(), g(), b(), a() {}
62  aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)
63  : r(_r), g(_g), b(_b), a(_a) {}
64  explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
65  aiColor4t (const aiColor4t& o)
66  : r(o.r), g(o.g), b(o.b), a(o.a) {}
67 
68 public:
69  // combined operators
70  const aiColor4t& operator += (const aiColor4t& o);
71  const aiColor4t& operator -= (const aiColor4t& o);
72  const aiColor4t& operator *= (TReal f);
73  const aiColor4t& operator /= (TReal f);
74 
75 public:
76  // comparison
77  bool operator == (const aiColor4t& other) const;
78  bool operator != (const aiColor4t& other) const;
79  bool operator < (const aiColor4t& other) const;
80 
81  // color tuple access, rgba order
82  inline TReal operator[](unsigned int i) const;
83  inline TReal& operator[](unsigned int i);
84 
86  inline bool IsBlack() const;
87 
88 public:
89 
90  // Red, green, blue and alpha color values
91  TReal r, g, b, a;
92 }; // !struct aiColor4D
93 
94 typedef aiColor4t<ai_real> aiColor4D;
95 
96 #else
97 
98 struct aiColor4D {
99  ai_real r, g, b, a;
100 };
101 
102 #endif // __cplusplus
103 
104 #endif // AI_COLOR4D_H_INC
Assimp build configuration setup.
Definition: color4.h:98