vrshoot

view libs/assimp/assimp/color4.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
6 Copyright (c) 2006-2012, assimp team
8 All rights reserved.
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
18 * Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
23 * Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 /** @file aiColor4D.h
42 * @brief RGBA color structure, including operators when compiling in C++
43 */
44 #ifndef AI_COLOR4D_H_INC
45 #define AI_COLOR4D_H_INC
47 #include "./Compiler/pushpack1.h"
49 #ifdef __cplusplus
51 // ----------------------------------------------------------------------------------
52 /** Represents a color in Red-Green-Blue space including an
53 * alpha component. Color values range from 0 to 1. */
54 // ----------------------------------------------------------------------------------
55 template <typename TReal>
56 class aiColor4t
57 {
58 public:
59 aiColor4t () : r(), g(), b(), a() {}
60 aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)
61 : r(_r), g(_g), b(_b), a(_a) {}
62 aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
63 aiColor4t (const aiColor4t& o)
64 : r(o.r), g(o.g), b(o.b), a(o.a) {}
66 public:
67 // combined operators
68 const aiColor4t& operator += (const aiColor4t& o);
69 const aiColor4t& operator -= (const aiColor4t& o);
70 const aiColor4t& operator *= (TReal f);
71 const aiColor4t& operator /= (TReal f);
73 public:
74 // comparison
75 bool operator == (const aiColor4t& other) const;
76 bool operator != (const aiColor4t& other) const;
78 // color tuple access, rgba order
79 inline TReal operator[](unsigned int i) const;
80 inline TReal& operator[](unsigned int i);
82 /** check whether a color is (close to) black */
83 inline bool IsBlack() const;
85 public:
87 // Red, green, blue and alpha color values
88 TReal r, g, b, a;
89 } PACK_STRUCT; // !struct aiColor4D
91 typedef aiColor4t<float> aiColor4D;
93 #else
95 struct aiColor4D {
96 float r, g, b, a;
97 } PACK_STRUCT;
99 #endif // __cplusplus
101 #include "./Compiler/poppack1.h"
103 #endif // AI_COLOR4D_H_INC