1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreColourValue.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
10 | <h1>OgreColourValue.h</h1><a href="OgreColourValue_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 <span class="preprocessor">#ifndef _COLOURVALUE_H__</span> |
---|
35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define _COLOURVALUE_H__</span> |
---|
36 | 00027 <span class="preprocessor"></span> |
---|
37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
38 | 00029 |
---|
39 | 00030 <span class="keyword">namespace </span>Ogre { |
---|
40 | 00031 |
---|
41 | <a name="l00032"></a><a class="code" href="namespaceOgre.html#a68">00032</a> <span class="keyword">typedef</span> <a class="code" href="namespaceOgre.html#a455">uint32</a> <a class="code" href="namespaceOgre.html#a68">RGBA</a>; |
---|
42 | <a name="l00033"></a><a class="code" href="namespaceOgre.html#a69">00033</a> <span class="keyword">typedef</span> <a class="code" href="namespaceOgre.html#a455">uint32</a> <a class="code" href="namespaceOgre.html#a69">ARGB</a>; |
---|
43 | <a name="l00034"></a><a class="code" href="namespaceOgre.html#a70">00034</a> <span class="keyword">typedef</span> <a class="code" href="namespaceOgre.html#a455">uint32</a> <a class="code" href="namespaceOgre.html#a70">ABGR</a>; |
---|
44 | <a name="l00035"></a><a class="code" href="namespaceOgre.html#a71">00035</a> <span class="keyword">typedef</span> <a class="code" href="namespaceOgre.html#a455">uint32</a> <a class="code" href="namespaceOgre.html#a71">BGRA</a>; |
---|
45 | 00036 |
---|
46 | <a name="l00048"></a><a class="code" href="classOgre_1_1ColourValue.html">00048</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> ColourValue |
---|
47 | 00049 { |
---|
48 | 00050 <span class="keyword">public</span>: |
---|
49 | <a name="l00051"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues0">00051</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue ZERO; |
---|
50 | <a name="l00052"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues1">00052</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue Black; |
---|
51 | <a name="l00053"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues2">00053</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue White; |
---|
52 | <a name="l00054"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues3">00054</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue Red; |
---|
53 | <a name="l00055"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues4">00055</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue Green; |
---|
54 | <a name="l00056"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValues5">00056</a> <span class="keyword">static</span> <span class="keyword">const</span> ColourValue Blue; |
---|
55 | 00057 |
---|
56 | <a name="l00058"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea0">00058</a> <span class="keyword">explicit</span> ColourValue( <span class="keywordtype">float</span> red = 1.0f, |
---|
57 | 00059 <span class="keywordtype">float</span> green = 1.0f, |
---|
58 | 00060 <span class="keywordtype">float</span> blue = 1.0f, |
---|
59 | 00061 <span class="keywordtype">float</span> alpha = 1.0f ) : r(red), g(green), b(blue), a(alpha) |
---|
60 | 00062 { } |
---|
61 | 00063 |
---|
62 | 00064 <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a623">operator==</a>(<span class="keyword">const</span> ColourValue& rhs) <span class="keyword">const</span>; |
---|
63 | 00065 <span class="keywordtype">bool</span> <a class="code" href="namespaceOgre.html#a624">operator!=</a>(<span class="keyword">const</span> ColourValue& rhs) <span class="keyword">const</span>; |
---|
64 | 00066 |
---|
65 | 00067 <span class="keyword">union </span>{ |
---|
66 | 00068 <span class="keyword">struct </span>{ |
---|
67 | <a name="l00069"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">00069</a> <span class="keywordtype">float</span> r,g,b,a; |
---|
68 | 00070 }; |
---|
69 | <a name="l00071"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo4">00071</a> <span class="keywordtype">float</span> val[4]; |
---|
70 | 00072 }; |
---|
71 | 00073 |
---|
72 | 00076 <a class="code" href="namespaceOgre.html#a68">RGBA</a> getAsRGBA(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
73 | 00077 |
---|
74 | 00080 <a class="code" href="namespaceOgre.html#a69">ARGB</a> getAsARGB(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
75 | 00081 |
---|
76 | 00084 <a class="code" href="namespaceOgre.html#a71">BGRA</a> getAsBGRA(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
77 | 00085 |
---|
78 | 00087 <a class="code" href="namespaceOgre.html#a70">ABGR</a> getAsABGR(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
79 | 00088 |
---|
80 | 00091 <span class="keywordtype">void</span> setAsRGBA(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a68">RGBA</a> val); |
---|
81 | 00092 |
---|
82 | 00095 <span class="keywordtype">void</span> setAsARGB(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a69">ARGB</a> val); |
---|
83 | 00096 |
---|
84 | 00099 <span class="keywordtype">void</span> setAsBGRA(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a71">BGRA</a> val); |
---|
85 | 00100 |
---|
86 | 00103 <span class="keywordtype">void</span> setAsABGR(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a70">ABGR</a> val); |
---|
87 | 00104 |
---|
88 | <a name="l00107"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea11">00107</a> <span class="keywordtype">void</span> saturate(<span class="keywordtype">void</span>) |
---|
89 | 00108 { |
---|
90 | 00109 <span class="keywordflow">if</span> (r < 0) |
---|
91 | 00110 r = 0; |
---|
92 | 00111 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (r > 1) |
---|
93 | 00112 r = 1; |
---|
94 | 00113 |
---|
95 | 00114 <span class="keywordflow">if</span> (g < 0) |
---|
96 | 00115 g = 0; |
---|
97 | 00116 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (g > 1) |
---|
98 | 00117 g = 1; |
---|
99 | 00118 |
---|
100 | 00119 <span class="keywordflow">if</span> (b < 0) |
---|
101 | 00120 b = 0; |
---|
102 | 00121 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (b > 1) |
---|
103 | 00122 b = 1; |
---|
104 | 00123 |
---|
105 | 00124 <span class="keywordflow">if</span> (a < 0) |
---|
106 | 00125 a = 0; |
---|
107 | 00126 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (a > 1) |
---|
108 | 00127 a = 1; |
---|
109 | 00128 } |
---|
110 | 00129 |
---|
111 | <a name="l00132"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea12">00132</a> ColourValue saturateCopy(<span class="keywordtype">void</span>)<span class="keyword"> const</span> |
---|
112 | 00133 <span class="keyword"> </span>{ |
---|
113 | 00134 ColourValue ret = *<span class="keyword">this</span>; |
---|
114 | 00135 ret.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea11">saturate</a>(); |
---|
115 | 00136 <span class="keywordflow">return</span> ret; |
---|
116 | 00137 } |
---|
117 | 00138 |
---|
118 | 00139 <span class="comment">// arithmetic operations</span> |
---|
119 | <a name="l00140"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea13">00140</a> <span class="keyword">inline</span> ColourValue operator + ( <span class="keyword">const</span> ColourValue& rkVector )<span class="keyword"> const</span> |
---|
120 | 00141 <span class="keyword"> </span>{ |
---|
121 | 00142 ColourValue kSum; |
---|
122 | 00143 |
---|
123 | 00144 kSum.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = r + rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a>; |
---|
124 | 00145 kSum.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = g + rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a>; |
---|
125 | 00146 kSum.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = b + rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a>; |
---|
126 | 00147 kSum.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = a + rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a>; |
---|
127 | 00148 |
---|
128 | 00149 <span class="keywordflow">return</span> kSum; |
---|
129 | 00150 } |
---|
130 | 00151 |
---|
131 | <a name="l00152"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea14">00152</a> <span class="keyword">inline</span> ColourValue operator - ( <span class="keyword">const</span> ColourValue& rkVector )<span class="keyword"> const</span> |
---|
132 | 00153 <span class="keyword"> </span>{ |
---|
133 | 00154 ColourValue kDiff; |
---|
134 | 00155 |
---|
135 | 00156 kDiff.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = r - rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a>; |
---|
136 | 00157 kDiff.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = g - rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a>; |
---|
137 | 00158 kDiff.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = b - rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a>; |
---|
138 | 00159 kDiff.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = a - rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a>; |
---|
139 | 00160 |
---|
140 | 00161 <span class="keywordflow">return</span> kDiff; |
---|
141 | 00162 } |
---|
142 | 00163 |
---|
143 | <a name="l00164"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea15">00164</a> <span class="keyword">inline</span> ColourValue <a class="code" href="namespaceOgre.html#a617">operator * </a>(<span class="keyword">const</span> <span class="keywordtype">float</span> fScalar )<span class="keyword"> const</span> |
---|
144 | 00165 <span class="keyword"> </span>{ |
---|
145 | 00166 ColourValue kProd; |
---|
146 | 00167 |
---|
147 | 00168 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = fScalar*r; |
---|
148 | 00169 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = fScalar*g; |
---|
149 | 00170 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = fScalar*b; |
---|
150 | 00171 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = fScalar*a; |
---|
151 | 00172 |
---|
152 | 00173 <span class="keywordflow">return</span> kProd; |
---|
153 | 00174 } |
---|
154 | 00175 |
---|
155 | <a name="l00176"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea16">00176</a> <span class="keyword">inline</span> ColourValue <a class="code" href="namespaceOgre.html#a617">operator * </a>( <span class="keyword">const</span> ColourValue& rhs)<span class="keyword"> const</span> |
---|
156 | 00177 <span class="keyword"> </span>{ |
---|
157 | 00178 ColourValue kProd; |
---|
158 | 00179 |
---|
159 | 00180 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> * r; |
---|
160 | 00181 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> * g; |
---|
161 | 00182 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> * b; |
---|
162 | 00183 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> * a; |
---|
163 | 00184 |
---|
164 | 00185 <span class="keywordflow">return</span> kProd; |
---|
165 | 00186 } |
---|
166 | 00187 |
---|
167 | <a name="l00188"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea17">00188</a> <span class="keyword">inline</span> ColourValue <a class="code" href="namespaceOgre.html#a618">operator / </a>( <span class="keyword">const</span> ColourValue& rhs)<span class="keyword"> const</span> |
---|
168 | 00189 <span class="keyword"> </span>{ |
---|
169 | 00190 ColourValue kProd; |
---|
170 | 00191 |
---|
171 | 00192 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> / r; |
---|
172 | 00193 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> / g; |
---|
173 | 00194 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> / b; |
---|
174 | 00195 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = rhs.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> / a; |
---|
175 | 00196 |
---|
176 | 00197 <span class="keywordflow">return</span> kProd; |
---|
177 | 00198 } |
---|
178 | 00199 |
---|
179 | <a name="l00200"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea18">00200</a> <span class="keyword">inline</span> ColourValue <a class="code" href="namespaceOgre.html#a618">operator / </a>(<span class="keyword">const</span> <span class="keywordtype">float</span> fScalar )<span class="keyword"> const</span> |
---|
180 | 00201 <span class="keyword"> </span>{ |
---|
181 | 00202 assert( fScalar != 0.0 ); |
---|
182 | 00203 |
---|
183 | 00204 ColourValue kDiv; |
---|
184 | 00205 |
---|
185 | 00206 <span class="keywordtype">float</span> fInv = 1.0 / fScalar; |
---|
186 | 00207 kDiv.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = r * fInv; |
---|
187 | 00208 kDiv.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = g * fInv; |
---|
188 | 00209 kDiv.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = b * fInv; |
---|
189 | 00210 kDiv.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = a * fInv; |
---|
190 | 00211 |
---|
191 | 00212 <span class="keywordflow">return</span> kDiv; |
---|
192 | 00213 } |
---|
193 | 00214 |
---|
194 | <a name="l00215"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuen0">00215</a> <span class="keyword">inline</span> <span class="keyword">friend</span> ColourValue <a class="code" href="namespaceOgre.html#a617">operator * </a>(<span class="keyword">const</span> <span class="keywordtype">float</span> fScalar, <span class="keyword">const</span> ColourValue& rkVector ) |
---|
195 | 00216 { |
---|
196 | 00217 ColourValue kProd; |
---|
197 | 00218 |
---|
198 | 00219 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a>; |
---|
199 | 00220 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a>; |
---|
200 | 00221 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a>; |
---|
201 | 00222 kProd.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a> = fScalar * rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a>; |
---|
202 | 00223 |
---|
203 | 00224 <span class="keywordflow">return</span> kProd; |
---|
204 | 00225 } |
---|
205 | 00226 |
---|
206 | 00227 <span class="comment">// arithmetic updates</span> |
---|
207 | <a name="l00228"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea19">00228</a> <span class="keyword">inline</span> ColourValue& operator += ( <span class="keyword">const</span> ColourValue& rkVector ) |
---|
208 | 00229 { |
---|
209 | 00230 r += rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a>; |
---|
210 | 00231 g += rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a>; |
---|
211 | 00232 b += rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a>; |
---|
212 | 00233 a += rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a>; |
---|
213 | 00234 |
---|
214 | 00235 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
215 | 00236 } |
---|
216 | 00237 |
---|
217 | <a name="l00238"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea20">00238</a> <span class="keyword">inline</span> ColourValue& operator -= ( <span class="keyword">const</span> ColourValue& rkVector ) |
---|
218 | 00239 { |
---|
219 | 00240 r -= rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo0">r</a>; |
---|
220 | 00241 g -= rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo1">g</a>; |
---|
221 | 00242 b -= rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo2">b</a>; |
---|
222 | 00243 a -= rkVector.<a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValueo3">a</a>; |
---|
223 | 00244 |
---|
224 | 00245 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
225 | 00246 } |
---|
226 | 00247 |
---|
227 | <a name="l00248"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea21">00248</a> <span class="keyword">inline</span> ColourValue& operator *= (<span class="keyword">const</span> <span class="keywordtype">float</span> fScalar ) |
---|
228 | 00249 { |
---|
229 | 00250 r *= fScalar; |
---|
230 | 00251 g *= fScalar; |
---|
231 | 00252 b *= fScalar; |
---|
232 | 00253 a *= fScalar; |
---|
233 | 00254 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
234 | 00255 } |
---|
235 | 00256 |
---|
236 | <a name="l00257"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuea22">00257</a> <span class="keyword">inline</span> ColourValue& operator /= (<span class="keyword">const</span> <span class="keywordtype">float</span> fScalar ) |
---|
237 | 00258 { |
---|
238 | 00259 assert( fScalar != 0.0 ); |
---|
239 | 00260 |
---|
240 | 00261 <span class="keywordtype">float</span> fInv = 1.0 / fScalar; |
---|
241 | 00262 |
---|
242 | 00263 r *= fInv; |
---|
243 | 00264 g *= fInv; |
---|
244 | 00265 b *= fInv; |
---|
245 | 00266 a *= fInv; |
---|
246 | 00267 |
---|
247 | 00268 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
248 | 00269 } |
---|
249 | 00270 |
---|
250 | 00276 <span class="keywordtype">void</span> setHSB(<a class="code" href="namespaceOgre.html#a465">Real</a> hue, <a class="code" href="namespaceOgre.html#a465">Real</a> saturation, <a class="code" href="namespaceOgre.html#a465">Real</a> brightness); |
---|
251 | 00277 |
---|
252 | 00278 |
---|
253 | 00281 <span class="keyword">inline</span> <a class="code" href="class__OgreExport.html">_OgreExport</a> <span class="keyword">friend</span> std::ostream& <span class="keyword">operator</span> << |
---|
254 | <a name="l00282"></a><a class="code" href="classOgre_1_1ColourValue.html#Ogre_1_1ColourValuen1">00282</a> ( std::ostream& o, <span class="keyword">const</span> ColourValue& c ) |
---|
255 | 00283 { |
---|
256 | 00284 o << <span class="stringliteral">"ColourValue("</span> << c.r << <span class="stringliteral">", "</span> << c.g << <span class="stringliteral">", "</span> << c.b << <span class="stringliteral">", "</span> << c.a << <span class="stringliteral">")"</span>; |
---|
257 | 00285 <span class="keywordflow">return</span> o; |
---|
258 | 00286 } |
---|
259 | 00287 |
---|
260 | 00288 }; |
---|
261 | 00289 |
---|
262 | 00290 } <span class="comment">// namespace</span> |
---|
263 | 00291 |
---|
264 | 00292 <span class="preprocessor">#endif</span> |
---|
265 | </pre></div><hr> |
---|
266 | <p> |
---|
267 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
268 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
269 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
270 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
271 | <Work rdf:about=""> |
---|
272 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
273 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
274 | </Work> |
---|
275 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
276 | |
---|
277 | Last modified Sun Mar 12 14:37:38 2006 |
---|
278 | </p> |
---|
279 | </body> |
---|
280 | </html> |
---|