OSG::Color4< ValueTypeT > Class Template Reference

#include <OSGColor.h>

Inheritance diagram for OSG::Color4< ValueTypeT >:

OSG::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > OSG::VecStorage4< ValueTypeT > List of all members.

Public Types

typedef ValueTypeT ValueType
typedef PointInterface< ValueTypeT,
VecStorage4< ValueTypeT > > 
Inherited
typedef TypeTraits< ValueTypeT
>::RealReturnType 
RealReturnType
typedef Inherited PntInterface
typedef VectorInterface< ValueTypeT,
VecStorage4< ValueTypeT > > 
Self
typedef VectorInterface< ValueTypeT,
VecStorage4< ValueTypeT > > 
VecInterface

Public Member Functions

RealReturnType length (void) const
RealReturnType squareLength (void) const
void normalize (void)
VectorInterface cross (const VectorInterface &vec) const
VectorInterface operator% (const VectorInterface &vec) const
void crossThis (const VectorInterface &vec)
ValueTypeT dot (const VectorInterface &vec) const
ValueTypeT dot (const PntInterface &pnt) const
ValueTypeT operator * (const VectorInterface &vec) const
ValueTypeT operator * (const PntInterface &pnt) const
VectorInterface operator * (const ValueTypeTrVal) const
RealReturnType enclosedAngle (const VectorInterface &vec) const
RealReturnType projectTo (const VectorInterface &toVec)
PntInterfaceaddToZero (void)
const PntInterfaceaddToZero (void) const
VectorInterfacesubZero (void)
const VectorInterfacesubZero (void) const
VectorInterface operator- (const VectorInterface &vec) const
VectorInterface operator- (void) const
VecInterface operator- (const PointInterface &vec) const
PointInterface operator- (const VecInterface &vec) const
PointInterface operator- (void)
VectorInterface operator+ (const VectorInterface &vec) const
PointInterface operator+ (const VecInterface &vec) const
bool operator< (const VectorInterface &other) const
bool operator< (const PointInterface &other) const
bool operator== (const VectorInterface &other) const
bool operator== (const PointInterface &other) const
bool operator!= (const VectorInterface &other) const
bool operator!= (const PointInterface &other) const
void setNull (void)
void setValue (const PointInterface &vec)
void setValue (const PointInterface< ValueType2T, StorageInterface2T > &vec)
void setValue (const ValueTypeT *pVals)
void setValue (ValueTypeT *pVals)
void setValue (Char8 *szString)
void setValueFromCString (const Char8 *szString)
void setValueFromCString (Char8 *szString)
ValueTypeT * getValues (void)
const ValueTypeT * getValues (void) const
bool isZero (void) const
void negate (void)
bool equals (const PointInterface &vec, const ValueTypeTtolerance) const
RealReturnType dist (const PointInterface &vec) const
RealReturnType dist2 (const PointInterface &vec) const
RealReturnType maxValue (void) const
void operator *= (const ValueTypeTval)
void operator/= (const ValueTypeTval)
void operator+= (const VecInterface &vec)
void operator-= (const VecInterface &vec)
ValueTypeT & operator[] (const UInt32 uiVal)
const ValueTypeT & operator[] (const UInt32 uiVal) const
Constructors


 Color4 (void)
 Color4 (const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &source)
 Color4 (const ValueType red, const ValueType green, const ValueType blue, const ValueType alpha)
Destructors


 ~Color4 (void)
Set


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


UInt32 getRGBA (void) const
void getValuesRGBA (ValueType &red, ValueType &green, ValueType &blue, ValueType &alpha) const
void getValuesHSV (Real32 &h, Real32 &s, Real32 &v) const
ValueType red (void) const
ValueType green (void) const
ValueType blue (void) const
ValueType alpha (void) const
ValueTypegetValuesRGBA (void)
const ValueTypegetValuesRGBA (void) const
Access


void setValues (const ValueTypeT rVal1, const ValueTypeT rVal2, const ValueTypeT rVal3, const ValueTypeT rVal4)
void getSeparateValues (ValueTypeT &rVal1, ValueTypeT &rVal2, ValueTypeT &rVal3, ValueTypeT &rVal4) const
ValueTypeT x (void) const
ValueTypeT y (void) const
ValueTypeT z (void) const
ValueTypeT w (void) const

Static Public Attributes

static const Color4 Null
static const UInt32 _uiSize = 4
 Storage size.

Protected Attributes

ValueTypeT _values [_uiSize]
 Value store.

Detailed Description

template<class ValueTypeT>
class OSG::Color4< ValueTypeT >

Definition at line 159 of file OSGColor.h.


Member Typedef Documentation

template<class ValueTypeT>
typedef ValueTypeT OSG::Color4< ValueTypeT >::ValueType

Reimplemented from OSG::VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > >.

Definition at line 164 of file OSGColor.h.

typedef PointInterface<ValueTypeT , VecStorage4< ValueTypeT > > OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::Inherited [inherited]

Reimplemented from OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >.

Definition at line 559 of file OSGVector.h.

typedef TypeTraits<ValueTypeT >::RealReturnType OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::RealReturnType [inherited]

Reimplemented from OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >.

Definition at line 561 of file OSGVector.h.

typedef Inherited OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::PntInterface [inherited]

Definition at line 565 of file OSGVector.h.

typedef VectorInterface<ValueTypeT , VecStorage4< ValueTypeT > > OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::Self [inherited]

Reimplemented from OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >.

Definition at line 568 of file OSGVector.h.

typedef VectorInterface<ValueTypeT , VecStorage4< ValueTypeT > > OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::VecInterface [inherited]

Definition at line 354 of file OSGVector.h.


Constructor & Destructor Documentation

template<class ValueTypeT>
OSG::Color4< ValueTypeT >::Color4 ( void   )  [inline]

Definition at line 414 of file OSGColor.inl.

References OSG::VecStorage4< ValueTypeT >::setValues().

00415 {
00416     setValues(TypeTraits<ValueTypeT>::getZeroElement(),
00417               TypeTraits<ValueTypeT>::getZeroElement(),
00418               TypeTraits<ValueTypeT>::getZeroElement(),
00419               TypeTraits<ValueTypeT>::getZeroElement());
00420 }

template<class ValueTypeT>
OSG::Color4< ValueTypeT >::Color4 ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  source  )  [inline]

Definition at line 424 of file OSGColor.inl.

00425                                                                        :
00426     VectorInterface<ValueTypeT, VecStorage4<ValueTypeT> >(source)
00427 {
00428 }

template<class ValueTypeT>
OSG::Color4< ValueTypeT >::Color4 ( const ValueType  red,
const ValueType  green,
const ValueType  blue,
const ValueType  alpha 
) [inline]

Definition at line 432 of file OSGColor.inl.

References OSG::VecStorage4< ValueTypeT >::setValues().

00436 {
00437     setValues(red, green, blue, alpha);
00438 }

template<class ValueTypeT>
OSG::Color4< ValueTypeT >::~Color4 ( void   )  [inline]

Definition at line 442 of file OSGColor.inl.

00443 {
00444 }


Member Function Documentation

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::clear ( void   )  [inline]

Definition at line 447 of file OSGColor.inl.

References OSG::VecStorage4< ValueTypeT >::setValues().

00448 {
00449     setValues(TypeTraits<ValueTypeT>::getZeroElement(),
00450               TypeTraits<ValueTypeT>::getZeroElement(),
00451               TypeTraits<ValueTypeT>::getZeroElement(),
00452               TypeTraits<ValueTypeT>::getZeroElement());
00453 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::setValuesRGBA ( const ValueType  red,
const ValueType  green,
const ValueType  blue,
const ValueType  alpha 
) [inline]

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

Definition at line 466 of file OSGColor.inl.

00469 {
00470     Color3<ValueType>::convertFromHSV(this->getValues(), h, s, v);
00471 
00472     (*this)[3] = TypeTraits<ValueTypeT>::getOneElement();
00473 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::setRandom ( void   )  [inline]

Definition at line 477 of file OSGColor.inl.

References OSG::Color4< ValueTypeT >::setValuesRGBA().

00478 {
00479     Real32 rf = 1.0 / Real32(RAND_MAX);
00480 
00481     setValuesRGBA(TypeTraits<ValueTypeT>::getPortion(rf * rand()),
00482                   TypeTraits<ValueTypeT>::getPortion(rf * rand()),
00483                   TypeTraits<ValueTypeT>::getPortion(rf * rand()),
00484                   TypeTraits<ValueTypeT>::getPortion(rf * rand()));
00485 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::setRGBA ( UInt32  rgbPack  )  [inline]

method to set the rgb values (ABGGRR)

Definition at line 491 of file OSGColor.inl.

00492 {
00493     for(Int32 i = 0; i < 4; ++i)
00494     {
00495         Real32 rTmp = Real32(rgbPack & 255) / 255.0f;
00496 
00497         (*this)[i] = TypeTraits<ValueTypeT>::getPortion(rTmp);
00498 
00499         rgbPack >>= 8;
00500     }
00501 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::setValue ( const Char8 *  szString  )  [inline]

template<class ValueTypeT>
UInt32 OSG::Color4< ValueTypeT >::getRGBA ( void   )  const [inline]

Definition at line 516 of file OSGColor.inl.

00517 {
00518     UInt32 pack = 0;
00519 
00520     for(Int32 i = 3; i >= 0; --i)
00521     {
00522         pack = (pack << 8) | 
00523             Int32(TypeTraits<ValueTypeT>::getFraction((*this)[i]) *
00524                   255.0f                                        +
00525                   0.5f                                           );
00526     }
00527 
00528     return pack;
00529 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::getValuesRGBA ( ValueType red,
ValueType green,
ValueType blue,
ValueType alpha 
) const [inline]

Definition at line 533 of file OSGColor.inl.

Referenced by OSG::SkyBackground::clear(), and OSG::Geometry::drawPrimitives().

00537 {
00538     red   = (*this)[0];
00539     green = (*this)[1];
00540     blue  = (*this)[2];
00541     alpha = (*this)[3];
00542 }

template<class ValueTypeT>
void OSG::Color4< ValueTypeT >::getValuesHSV ( Real32 &  h,
Real32 &  s,
Real32 &  v 
) const [inline]

Definition at line 546 of file OSGColor.inl.

00549 {
00550     Color3<ValueType>::convertToHSV(this->getValues(), h, s, v);
00551 }

template<class ValueTypeT>
Color4< ValueTypeT >::ValueType OSG::Color4< ValueTypeT >::red ( void   )  const [inline]

Definition at line 556 of file OSGColor.inl.

Referenced by OSG::blendImage().

00557 {
00558     return (*this)[0];
00559 }

template<class ValueTypeT>
Color4< ValueTypeT >::ValueType OSG::Color4< ValueTypeT >::green ( void   )  const [inline]

Definition at line 564 of file OSGColor.inl.

Referenced by OSG::blendImage().

00565 {
00566     return (*this)[1];
00567 }

template<class ValueTypeT>
Color4< ValueTypeT >::ValueType OSG::Color4< ValueTypeT >::blue ( void   )  const [inline]

Definition at line 572 of file OSGColor.inl.

Referenced by OSG::blendImage().

00573 {
00574     return (*this)[2];
00575 }

template<class ValueTypeT>
Color4< ValueTypeT >::ValueType OSG::Color4< ValueTypeT >::alpha ( void   )  const [inline]

Definition at line 580 of file OSGColor.inl.

Referenced by OSG::blendImage().

00581 {
00582     return (*this)[3];
00583 }

template<class ValueTypeT>
Color4< ValueTypeT >::ValueType * OSG::Color4< ValueTypeT >::getValuesRGBA ( void   )  [inline]

Definition at line 588 of file OSGColor.inl.

References OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::getValues().

00589 {
00590     return this->getValues();
00591 }

template<class ValueTypeT>
const Color4< ValueTypeT >::ValueType * OSG::Color4< ValueTypeT >::getValuesRGBA ( void   )  const [inline]

Definition at line 596 of file OSGColor.inl.

References OSG::PointInterface< ValueTypeT, VecStorage4< ValueTypeT > >::getValues().

00597 {
00598     return this->getValues();
00599 }

RealReturnType OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::length ( void   )  const [inherited]

RealReturnType OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::squareLength ( void   )  const [inherited]

void OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::normalize ( void   )  [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::cross ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator% ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

void OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::crossThis ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  [inherited]

ValueTypeT OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::dot ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

ValueTypeT OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::dot ( const PntInterface pnt  )  const [inherited]

ValueTypeT OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator * ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

ValueTypeT OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator * ( const PntInterface pnt  )  const [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator * ( const ValueTypeT   rVal  )  const [inherited]

RealReturnType OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::enclosedAngle ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

RealReturnType OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::projectTo ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  toVec  )  [inherited]

PntInterface& OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::addToZero ( void   )  [inherited]

const PntInterface& OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::addToZero ( void   )  const [inherited]

VectorInterface& OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::subZero ( void   )  [inherited]

const VectorInterface& OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::subZero ( void   )  const [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator- ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator- ( void   )  const [inherited]

VecInterface OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator- ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

PointInterface OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator- ( const VecInterface vec  )  const [inherited]

PointInterface OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator- ( void   )  [inherited]

VectorInterface OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator+ ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

PointInterface OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator+ ( const VecInterface vec  )  const [inherited]

bool OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator< ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

bool OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator< ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

bool OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator== ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

bool OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator== ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

bool OSG::VectorInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator!= ( const VectorInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

bool OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator!= ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  other  )  const [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setNull ( void   )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValue ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValue ( const PointInterface< ValueType2T, StorageInterface2T > &  vec  )  [inline, inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValue ( const ValueTypeT *  pVals  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValue ( ValueTypeT *  pVals  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValue ( Char8 *  szString  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValueFromCString ( const Char8 *  szString  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::setValueFromCString ( Char8 *  szString  )  [inherited]

ValueTypeT * OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::getValues ( void   )  [inherited]

const ValueTypeT * OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::getValues ( void   )  const [inherited]

bool OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::isZero ( void   )  const [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::negate ( void   )  [inherited]

bool OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::equals ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec,
const ValueTypeT   tolerance 
) const [inherited]

RealReturnType OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::dist ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

RealReturnType OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::dist2 ( const PointInterface< ValueTypeT, VecStorage4< ValueTypeT > > &  vec  )  const [inherited]

RealReturnType OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::maxValue ( void   )  const [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator *= ( const ValueTypeT   val  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator/= ( const ValueTypeT   val  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator+= ( const VecInterface vec  )  [inherited]

void OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator-= ( const VecInterface vec  )  [inherited]

ValueTypeT & OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator[] ( const UInt32  uiVal  )  [inherited]

const ValueTypeT & OSG::PointInterface< ValueTypeT , VecStorage4< ValueTypeT > >::operator[] ( const UInt32  uiVal  )  const [inherited]

template<class ValueTypeT>
void OSG::VecStorage4< ValueTypeT >::setValues ( const ValueTypeT  rVal1,
const ValueTypeT  rVal2,
const ValueTypeT  rVal3,
const ValueTypeT  rVal4 
) [inline, inherited]

template<class ValueTypeT>
void