osg::Color3< ValueTypeT > Class Template Reference
[Colors]

#include <OSGColor.h>

Inheritance diagram for osg::Color3< ValueTypeT >:

osg::Color3f osg::Color3ub

List of all members.

Public Types

typedef ValueTypeT ValueType

Public Member Functions

Constructors


 Color3 (void)
 Color3 (const Color3 &source)
 Color3 (ValueType red, ValueType green, ValueType blue)
Destructors


 ~Color3 (void)
Set


void clear (void)
void setValuesRGB (const ValueType red, const ValueType green, const ValueType blue)
void setValuesHSV (const Real32 h, const Real32 s, const Real32 v)
void setRandom (void)
void setRGB (UInt32 rgbPack)
void setValue (const Char8 *szString)
void setValue (Char8 *szString)
Get


UInt32 getRGB (void) const
void getValuesRGB (ValueType &red, ValueType &green, ValueType &blue) const
void getValuesHSV (Real32 &h, Real32 &s, Real32 &v) const
ValueType red (void) const
ValueType green (void) const
ValueType blue (void) const
ValueTypegetValuesRGB (void)
const ValueTypegetValuesRGB (void) const
Operators


Color3 operator* (const ValueType val)
Color3 operator/ (const ValueType val)
Color3 operator+ (const ValueType val)
Color3 operator- (const ValueType val)
void operator*= (const ValueType val)
void operator/= (const ValueType val)
void operator+= (const ValueType val)
void operator-= (const ValueType val)
Color3 operator* (const Color3 &other) const
Color3 operator/ (const Color3 &other) const
Color3 operator+ (const Color3 &other) const
Color3 operator- (const Color3 &other) const
void operator*= (const Color3 &other)
void operator/= (const Color3 &other)
void operator+= (const Color3 &other)
void operator-= (const Color3 &other)
ValueTypeoperator[] (const UInt32 uiIndex)
const ValueTypeoperator[] (const UInt32 uiIndex) const
Color3operator= (const Color3 &source)
bool equals (const Color3 &other, const ValueType tolerance) const
bool operator< (const Color3 &other) const
bool operator== (const Color3 &other) const
bool operator!= (const Color3 &other) const

Static Public Member Functions

Class Specific


static void convertFromHSV (ValueType *rgbP, const Real32 h, const Real32 s, const Real32 v)
static void convertToHSV (const ValueType *rgbP, Real32 &h, Real32 &s, Real32 &v)
static UInt32 minPart (const ValueType *rgbP)
static UInt32 maxPart (const ValueType *rgbP)

Static Public Attributes

static const Color3 Null

Protected Attributes

ValueType _rgb [3]


Detailed Description

template<class ValueTypeT>
class osg::Color3< ValueTypeT >

Definition at line 55 of file OSGColor.h.


Member Typedef Documentation

template<class ValueTypeT>
typedef ValueTypeT osg::Color3< ValueTypeT >::ValueType

Definition at line 61 of file OSGColor.h.


Constructor & Destructor Documentation

template<class ValueTypeT>
osg::Color3< ValueTypeT >::Color3 ( void   )  [inline]

Definition at line 240 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00241 {
00242     _rgb[0] = TypeTraits<ValueTypeT>::getZeroElement();
00243     _rgb[1] = TypeTraits<ValueTypeT>::getZeroElement();
00244     _rgb[2] = TypeTraits<ValueTypeT>::getZeroElement();
00245 }

template<class ValueTypeT>
osg::Color3< ValueTypeT >::Color3 ( const Color3< ValueTypeT > &  source  )  [inline]

Definition at line 249 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00250 {
00251     _rgb[0] = source._rgb[0];
00252     _rgb[1] = source._rgb[1];
00253     _rgb[2] = source._rgb[2];
00254 }

template<class ValueTypeT>
osg::Color3< ValueTypeT >::Color3 ( ValueType  red,
ValueType  green,
ValueType  blue 
) [inline]

Definition at line 258 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00261 {
00262     _rgb[0] = r;
00263     _rgb[1] = g;
00264     _rgb[2] = b;
00265 }

template<class ValueTypeT>
osg::Color3< ValueTypeT >::~Color3 ( void   )  [inline]

Definition at line 269 of file OSGColor.inl.

00270 {
00271 }


Member Function Documentation

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::convertFromHSV ( ValueType rgbP,
const Real32  h,
const Real32  s,
const Real32  v 
) [inline, static]

Definition at line 60 of file OSGColor.inl.

References p.

Referenced by osg::Color3< ValueTypeT >::setValuesHSV().

00064 {
00065     if(rgbP == NULL)
00066         return;
00067 
00068     Int32  i;
00069     Real32 f;
00070     Real32 p;
00071     Real32 q;
00072     Real32 t;
00073 
00074     if(s)
00075     {
00076         f = (h == 360) ? 0.0 : (h / 60.0);
00077         i = Int32(f);
00078 
00079         f = f - Real32(i);
00080 
00081         p = v * (1.0 -  s           );
00082         q = v * (1.0 - (s *      f) );
00083         t = v * (1.0 - (s * (1 - f)));
00084 
00085         switch (i)
00086         {
00087             case 0:
00088                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(v);
00089                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(t);
00090                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(p);
00091                 break;
00092             case 1:
00093                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(q);
00094                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(v);
00095                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(p);
00096                 break;
00097             case 2:
00098                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(p);
00099                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(v);
00100                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(t);
00101                 break;
00102             case 3:
00103                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(p);
00104                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(q);
00105                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(v);
00106                 break;
00107             case 4:
00108                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(t);
00109                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(p);
00110                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(v);
00111                 break;
00112             case 5:
00113                 rgbP[0] = TypeTraits<ValueTypeT>::getPortion(v);
00114                 rgbP[1] = TypeTraits<ValueTypeT>::getPortion(p);
00115                 rgbP[2] = TypeTraits<ValueTypeT>::getPortion(q);
00116                 break;
00117             default:
00118                 std::cerr << "ERROR i not in [0, 5] in Color::setHSV()!"
00119                      << std::endl;
00120                 break;
00121         }
00122     }
00123     else
00124     {
00125         rgbP[0] = rgbP[1] = rgbP[2] =
00126             TypeTraits<ValueTypeT>::getPortion(v);
00127     }
00128 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::convertToHSV ( const ValueType rgbP,
Real32 h,
Real32 s,
Real32 v 
) [inline, static]

Definition at line 132 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::maxPart(), and osg::Color3< ValueTypeT >::minPart().

Referenced by osg::Color3< ValueTypeT >::getValuesHSV().

00136 {
00137     if(rgbP == NULL)
00138         return;
00139 
00140     const Real32 r        = TypeTraits<ValueTypeT>::getFraction(rgbP[0]);
00141     const Real32 g        = TypeTraits<ValueTypeT>::getFraction(rgbP[1]);
00142     const Real32 b        = TypeTraits<ValueTypeT>::getFraction(rgbP[2]);
00143 
00144     const Int32  maxIndex = maxPart(rgbP);
00145     const Int32  minIndex = minPart(rgbP);
00146 
00147     const Real32 max      = TypeTraits<ValueTypeT>::getFraction(
00148         rgbP[maxIndex]);
00149 
00150     const Real32 min      = TypeTraits<ValueTypeT>::getFraction(
00151         rgbP[minIndex]);
00152 
00153     const Real32 delta    = max - min;
00154 
00155     v = max;
00156     s = max ? (max - min) / max : 0.0;
00157 
00158     if(s)
00159     {
00160         switch(maxIndex)
00161         {
00162             case 0: // red part is max;
00163                 h = (( g - b) / delta) * 60.0;
00164                 break;
00165             case 1: // green part is max;
00166                 h = (2.0 + (( b - r) / delta)) * 60.0;
00167                 break;
00168             case 2: // blue part is max
00169                 h = (4.0 + (( r - g) / delta)) * 60.0;
00170                 break;
00171         }
00172 
00173         if(h < 0.0)
00174             h += 360.0;
00175     }
00176     else
00177     {
00178         h = 0.0;
00179     }
00180 }

template<class ValueTypeT>
UInt32 osg::Color3< ValueTypeT >::minPart ( const ValueType rgbP  )  [inline, static]

Definition at line 212 of file OSGColor.inl.

Referenced by osg::Color3< ValueTypeT >::convertToHSV().

00213 {
00214     if(rgbP[0] < rgbP[1])
00215     {
00216         if(rgbP[2] < rgbP[0])
00217         {
00218             return 2;
00219         }
00220         else
00221         {
00222             return 0;
00223         }
00224     }
00225     else
00226     {
00227         if(rgbP[2] < rgbP[1])
00228         {
00229             return 2;
00230         }
00231         else
00232         {
00233             return 1;
00234         }
00235     }
00236 }

template<class ValueTypeT>
UInt32 osg::Color3< ValueTypeT >::maxPart ( const ValueType rgbP  )  [inline, static]

Definition at line 184 of file OSGColor.inl.

Referenced by osg::Color3< ValueTypeT >::convertToHSV().

00185 {
00186     if(rgbP[0] > rgbP[1])
00187     {
00188         if(rgbP[2] > rgbP[0])
00189         {
00190             return 2;
00191         }
00192         else
00193         {
00194             return 0;
00195         }
00196     }
00197     else
00198     {
00199         if (rgbP[2] > rgbP[1])
00200         {
00201             return 2;
00202         }
00203         else
00204         {
00205             return 1;
00206         }
00207     }
00208 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::clear ( void   )  [inline]

Definition at line 275 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00276 {
00277     _rgb[0] = TypeTraits<ValueTypeT>::getZeroElement();
00278     _rgb[1] = TypeTraits<ValueTypeT>::getZeroElement();
00279     _rgb[2] = TypeTraits<ValueTypeT>::getZeroElement();
00280 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setValuesRGB ( const ValueType  red,
const ValueType  green,
const ValueType  blue 
) [inline]

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setValuesHSV ( const Real32  h,
const Real32  s,
const Real32  v 
) [inline]

Definition at line 295 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb, and osg::Color3< ValueTypeT >::convertFromHSV().

00298 {
00299     convertFromHSV(_rgb, h, s, v);
00300 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setRandom ( void   )  [inline]

Definition at line 304 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::setValuesRGB().

00305 {
00306     Real32 rf = 1.0 / Real32(RAND_MAX);
00307 
00308     setValuesRGB(TypeTraits<ValueTypeT>::getPortion(rf * rand()),
00309                  TypeTraits<ValueTypeT>::getPortion(rf * rand()),
00310                  TypeTraits<ValueTypeT>::getPortion(rf * rand()));
00311 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setRGB ( UInt32  rgbPack  )  [inline]

method to set the rgb values (BBGGRR)

Definition at line 317 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00318 {
00319     for(Int32 i = 0; i < 3; ++i)
00320     {
00321         Real32 rTmp = Real32(rgbPack & 255) / 255.0f;
00322 
00323         _rgb[i] = TypeTraits<ValueTypeT>::getPortion(rTmp);
00324 
00325         rgbPack >>= 8;
00326     }
00327 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setValue ( const Char8 szString  )  [inline]

Definition at line 331 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb, and osg::PointInterface< ValueTypeT, StorageInterfaceT >::setValueFromCString().

Referenced by osg::ClusterWindow::loadCalibration(), osg::ClusterWindow::loadFilter(), and osg::Color3< ValueTypeT >::setValue().

00332 {
00333     // this is the easiest way, not the most efficient...
00334 
00335     Vec3f v;
00336 
00337     v.setValueFromCString(szString);
00338 
00339     _rgb[0] = ValueTypeT(v[0]);
00340     _rgb[1] = ValueTypeT(v[1]);
00341     _rgb[2] = ValueTypeT(v[2]);
00342 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::setValue ( Char8 szString  )  [inline]

Definition at line 346 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::setValue().

00347 {
00348     setValue(static_cast<const Char8 *>(szString));
00349 }

template<class ValueTypeT>
UInt32 osg::Color3< ValueTypeT >::getRGB ( void   )  const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 356 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00357 {
00358     UInt32 pack = 0;
00359 
00360     for(Int32 i = 2; i >= 0; --i)
00361     {
00362         pack = (pack << 8) | 
00363             Int32(TypeTraits<ValueTypeT>::getFraction(_rgb[i]) *
00364                   255.0f                                          +
00365                   0.5f                                            );
00366     }
00367 
00368     return pack;
00369 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::getValuesRGB ( ValueType red,
ValueType green,
ValueType blue 
) const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 373 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

Referenced by osg::GradientBackground::clear(), and osg::MergeGraphOp::processTransformations().

00376 {
00377     red   = _rgb[0];
00378     green = _rgb[1];
00379     blue  = _rgb[2];
00380 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::getValuesHSV ( Real32 h,
Real32 s,
Real32 v 
) const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 384 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb, and osg::Color3< ValueTypeT >::convertToHSV().

00387 {
00388     convertToHSV(_rgb, h, s, v);
00389 }

template<class ValueTypeT>
Color3< ValueTypeT >::ValueType osg::Color3< ValueTypeT >::red ( void   )  const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 394 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

Referenced by osg::operator<<().

00395 {
00396     return _rgb[0];
00397 }

template<class ValueTypeT>
Color3< ValueTypeT >::ValueType osg::Color3< ValueTypeT >::green ( void   )  const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 401 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

Referenced by osg::operator<<().

00402 {
00403     return _rgb[1];
00404 }

template<class ValueTypeT>
Color3< ValueTypeT >::ValueType osg::Color3< ValueTypeT >::blue ( void   )  const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 408 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

Referenced by osg::operator<<().

00409 {
00410     return _rgb[2];
00411 }

template<class ValueTypeT>
Color3< ValueTypeT >::ValueType * osg::Color3< ValueTypeT >::getValuesRGB ( void   )  [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 416 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00417 {
00418     return _rgb;
00419 }

template<class ValueTypeT>
const Color3< ValueTypeT >::ValueType * osg::Color3< ValueTypeT >::getValuesRGB ( void   )  const [inline]

method to get a packed rgb value (BBGGRR)

Definition at line 423 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00424 {
00425     return _rgb;
00426 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator* ( const ValueType  val  )  [inline]

Definition at line 430 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00431 {
00432     Color3<ValueTypeT> returnValue;
00433 
00434     returnValue._rgb[0] = _rgb[0] * val;
00435     returnValue._rgb[1] = _rgb[1] * val;
00436     returnValue._rgb[2] = _rgb[2] * val;
00437 
00438     return returnValue;
00439 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator/ ( const ValueType  val  )  [inline]

Definition at line 442 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00443 {
00444     Color3<ValueTypeT> returnValue;
00445 
00446     returnValue._rgb[0] = _rgb[0] / val;
00447     returnValue._rgb[1] = _rgb[1] / val;
00448     returnValue._rgb[2] = _rgb[2] / val;
00449 
00450     return returnValue;
00451 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator+ ( const ValueType  val  )  [inline]

Definition at line 454 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00455 {
00456     Color3<ValueTypeT> returnValue;
00457 
00458     returnValue._rgb[0] = _rgb[0] + val;
00459     returnValue._rgb[1] = _rgb[1] + val;
00460     returnValue._rgb[2] = _rgb[2] + val;
00461 
00462     return returnValue;
00463 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator- ( const ValueType  val  )  [inline]

Definition at line 466 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00467 {
00468     Color3<ValueTypeT> returnValue;
00469 
00470     returnValue._rgb[0] = _rgb[0] - val;
00471     returnValue._rgb[1] = _rgb[1] - val;
00472     returnValue._rgb[2] = _rgb[2] - val;
00473 
00474     return returnValue;
00475 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator*= ( const ValueType  val  )  [inline]

Definition at line 478 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00479 {
00480     _rgb[0] *= val;
00481     _rgb[1] *= val;
00482     _rgb[2] *= val;
00483 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator/= ( const ValueType  val  )  [inline]

Definition at line 486 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00487 {
00488     _rgb[0] /= val;
00489     _rgb[1] /= val;
00490     _rgb[2] /= val;
00491 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator+= ( const ValueType  val  )  [inline]

Definition at line 494 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00495 {
00496     _rgb[0] += val;
00497     _rgb[1] += val;
00498     _rgb[2] += val;
00499 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator-= ( const ValueType  val  )  [inline]

Definition at line 502 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00503 {
00504     _rgb[0] -= val;
00505     _rgb[1] -= val;
00506     _rgb[2] -= val;
00507 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator* ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 510 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00511 {
00512     Color3<ValueTypeT> returnValue;
00513 
00514     returnValue._rgb[0] = _rgb[0] * other._rgb[0];
00515     returnValue._rgb[1] = _rgb[1] * other._rgb[1];
00516     returnValue._rgb[2] = _rgb[2] * other._rgb[2];
00517 
00518     return returnValue;
00519 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator/ ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 522 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00523 {
00524     Color3<ValueTypeT> returnValue;
00525 
00526     returnValue._rgb[0] = _rgb[0] / other._rgb[0];
00527     returnValue._rgb[1] = _rgb[1] / other._rgb[1];
00528     returnValue._rgb[2] = _rgb[2] / other._rgb[2];
00529 
00530     return returnValue;
00531 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator+ ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 534 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00535 {
00536     Color3<ValueTypeT> returnValue;
00537 
00538     returnValue._rgb[0] = _rgb[0] + other._rgb[0];
00539     returnValue._rgb[1] = _rgb[1] + other._rgb[1];
00540     returnValue._rgb[2] = _rgb[2] + other._rgb[2];
00541 
00542     return returnValue;
00543 }

template<class ValueTypeT>
Color3< ValueTypeT > osg::Color3< ValueTypeT >::operator- ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 546 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00547 {
00548     Color3<ValueTypeT> returnValue;
00549 
00550     returnValue._rgb[0] = _rgb[0] - other._rgb[0];
00551     returnValue._rgb[1] = _rgb[1] - other._rgb[1];
00552     returnValue._rgb[2] = _rgb[2] - other._rgb[2];
00553 
00554     return returnValue;
00555 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator*= ( const Color3< ValueTypeT > &  other  )  [inline]

Definition at line 558 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00559 {
00560     _rgb[0] *= other._rgb[0];
00561     _rgb[1] *= other._rgb[1];
00562     _rgb[2] *= other._rgb[2];
00563 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator/= ( const Color3< ValueTypeT > &  other  )  [inline]

Definition at line 566 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00567 {
00568     _rgb[0] /= other._rgb[0];
00569     _rgb[1] /= other._rgb[1];
00570     _rgb[2] /= other._rgb[2];
00571 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator+= ( const Color3< ValueTypeT > &  other  )  [inline]

Definition at line 574 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00575 {
00576     _rgb[0] += other._rgb[0];
00577     _rgb[1] += other._rgb[1];
00578     _rgb[2] += other._rgb[2];
00579 }

template<class ValueTypeT>
void osg::Color3< ValueTypeT >::operator-= ( const Color3< ValueTypeT > &  other  )  [inline]

Definition at line 582 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00583 {
00584     _rgb[0] -= other._rgb[0];
00585     _rgb[1] -= other._rgb[1];
00586     _rgb[2] -= other._rgb[2];
00587 }

template<class ValueTypeT>
Color3< ValueTypeT >::ValueType & osg::Color3< ValueTypeT >::operator[] ( const UInt32  uiIndex  )  [inline]

Definition at line 591 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00593 {
00594     return _rgb[uiIndex];
00595 }

template<class ValueTypeT>
const Color3< ValueTypeT >::ValueType & osg::Color3< ValueTypeT >::operator[] ( const UInt32  uiIndex  )  const [inline]

Definition at line 599 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00601 {
00602     return _rgb[uiIndex];
00603 }

template<class ValueTypeT>
Color3< ValueTypeT > & osg::Color3< ValueTypeT >::operator= ( const Color3< ValueTypeT > &  source  )  [inline]

Definition at line 607 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00608 {
00609     if (this == &other)
00610         return *this;
00611 
00612     _rgb[0] = other._rgb[0];
00613     _rgb[1] = other._rgb[1];
00614     _rgb[2] = other._rgb[2];
00615 
00616     return *this;
00617 }

template<class ValueTypeT>
bool osg::Color3< ValueTypeT >::equals ( const Color3< ValueTypeT > &  other,
const ValueType  tolerance 
) const [inline]

Definition at line 621 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00623 {
00624     bool returnValue = true;
00625 
00626     for(UInt32 i = 0; i < 3; i++)
00627     {
00628         returnValue &= ( (      _rgb[i] - other._rgb[i] <= tolerance) &&
00629                          (other._rgb[i] -       _rgb[i] <= tolerance));
00630     }
00631 
00632     return returnValue;
00633 }

template<class ValueTypeT>
bool osg::Color3< ValueTypeT >::operator< ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 637 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb.

00638 {
00639     bool ret = false;
00640 
00641     for(UInt32 i = 0; i < 3; ++i)
00642     {
00643         if(_rgb[i] > other._rgb[i])
00644         {
00645             break;
00646         }
00647         if(_rgb[i] < other._rgb[i])
00648         {
00649             ret = true;
00650             break;
00651         }
00652     }
00653 
00654     return ret;
00655 }

template<class ValueTypeT>
bool osg::Color3< ValueTypeT >::operator== ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 658 of file OSGColor.inl.

References osg::Color3< ValueTypeT >::_rgb, and osg::Eps.

00659 {
00660     bool returnValue = true;
00661 
00662     for(UInt32 i = 0; i < 3; i++)
00663     {
00664         returnValue &= ( (      _rgb[i] - other._rgb[i] <= Eps) &&
00665                          (other._rgb[i] -       _rgb[i] <= Eps));
00666     }
00667 
00668     return returnValue;
00669 }

template<class ValueTypeT>
bool osg::Color3< ValueTypeT >::operator!= ( const Color3< ValueTypeT > &  other  )  const [inline]

Definition at line 673 of file OSGColor.inl.

00674 {
00675     return ! (*this == other);
00676 }


Member Data Documentation

template<class ValueTypeT>
const Color3< ValueTypeT > osg::Color3< ValueTypeT >::Null [inline, static]

template<class ValueTypeT>
ValueType osg::Color3< ValueTypeT >::_rgb[3] [protected]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 11:10:44 2008 for OpenSG by  doxygen 1.5.5