00001
00011
00012
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016
00017 #ifndef __XSICOLOR4F_H__
00018 #define __XSICOLOR4F_H__
00019
00020 #include "sicppsdk.h"
00021 #include <xsi_math.h>
00022
00023 namespace XSI {
00024
00025 namespace MATH {
00026
00027
00032
00033 class CColor4f
00034 {
00035 public:
00038 enum Type
00039 {
00040 siRGBA,
00041 siHSVA,
00042 siHLSA,
00043 };
00044
00046 SICPPSDK_INLINE CColor4f();
00047
00054 SICPPSDK_INLINE CColor4f(float in_R, float in_G, float in_B, float in_A);
00055
00063 SICPPSDK_INLINE CColor4f(float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType );
00064
00068 SICPPSDK_INLINE CColor4f( const CColor4f& in_color );
00069
00071 ~CColor4f() {};
00072
00079 SICPPSDK_INLINE void Set(float in_R,float in_G,float in_B,float in_A);
00080
00088 SICPPSDK_INLINE void Set( float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType );
00089
00094 SICPPSDK_INLINE float& PutR( const float in_R );
00095
00100 SICPPSDK_INLINE float& PutG( const float in_G );
00101
00106 SICPPSDK_INLINE float& PutB( const float in_B );
00107
00112 SICPPSDK_INLINE float& PutA( const float in_A );
00113
00120 SICPPSDK_INLINE void GetAsRGBA( float &out_R, float &out_G, float &out_B, float &out_A ) const;
00121
00128 SICPPSDK_INLINE void GetAsHLSA( float &out_H, float &out_L, float &out_S, float &out_A ) const;
00129
00136 SICPPSDK_INLINE void GetAsHSVA( float &out_H, float &out_S, float &out_V, float &out_A) const;
00137
00141 SICPPSDK_INLINE float GetH() const;
00142
00146 SICPPSDK_INLINE float GetL() const;
00147
00151 SICPPSDK_INLINE float GetS_HSVA() const;
00152
00156 SICPPSDK_INLINE float GetS_HLSA() const;
00157
00161 SICPPSDK_INLINE float GetV() const;
00162
00166 SICPPSDK_INLINE float& GetR();
00167
00171 SICPPSDK_INLINE float& GetG();
00172
00176 SICPPSDK_INLINE float& GetB();
00177
00181 SICPPSDK_INLINE float& GetA();
00182
00186 SICPPSDK_INLINE float* GetRGBA();
00187
00191 SICPPSDK_INLINE const float& GetR()const;
00192
00196 SICPPSDK_INLINE const float& GetG()const;
00197
00201 SICPPSDK_INLINE const float& GetB()const;
00202
00206 SICPPSDK_INLINE const float& GetA()const;
00207
00211 SICPPSDK_INLINE const float* GetRGBA()const;
00212
00216 SICPPSDK_INLINE operator float*();
00217
00221 SICPPSDK_INLINE bool operator==(const CColor4f& in_rColor4f )const;
00222
00226 SICPPSDK_INLINE bool operator!=(const CColor4f& in_rColor4f )const ;
00227
00235 SICPPSDK_INLINE bool operator < (const CColor4f& in_rColor4f )const;
00236
00241 SICPPSDK_INLINE bool IsNull(float in_fEpsilon) const;
00242
00247 SICPPSDK_INLINE CColor4f& Add(const CColor4f& in_col);
00248
00253 SICPPSDK_INLINE CColor4f& Mul(float in_fFactor);
00254
00259 SICPPSDK_INLINE CColor4f& Mul( const CColor4f& in_col );
00260
00265 SICPPSDK_INLINE CColor4f& Sub( const CColor4f& in_col );
00266
00270 SICPPSDK_INLINE CColor4f& Negate();
00271
00275 SICPPSDK_INLINE void PutNull();
00276
00280 SICPPSDK_INLINE float GetBrightness()const;
00281
00285 SICPPSDK_INLINE float GetBrightnessWithAlpha()const;
00286
00290 SICPPSDK_INLINE float GetGrayscale()const;
00291
00295 SICPPSDK_INLINE float GetGrayscaleWithAlpha()const;
00296
00300 SICPPSDK_INLINE CColor4f& InverseRGB();
00301
00302 private:
00303 SICPPSDK_INLINE LONG RoundDown(float a) const;
00304 SICPPSDK_INLINE void MinMax( float& out_fMin, float& out_fMax ) const;
00305 SICPPSDK_INLINE bool AreAlmostEqual(const CColor4f& in_c1,const CColor4f& in_c2,const float in_fEpsilon = MicroEPS);
00306
00307 enum Component
00308 {
00309 R=0,G,B,A,N
00310 };
00311 float m_RGBA[4];
00312 };
00313
00314 SICPPSDK_INLINE CColor4f::CColor4f()
00315 {
00316 m_RGBA[R] = 0.0f;
00317 m_RGBA[G] = 0.0f;
00318 m_RGBA[B] = 0.0f;
00319 m_RGBA[A] = 0.0f;
00320 }
00321
00322 SICPPSDK_INLINE CColor4f::CColor4f(float in_R, float in_G, float in_B, float in_A)
00323 {
00324 m_RGBA[R] = in_R;
00325 m_RGBA[G] = in_G;
00326 m_RGBA[B] = in_B;
00327 m_RGBA[A] = in_A;
00328 }
00329
00330 SICPPSDK_INLINE CColor4f::CColor4f(float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType )
00331 {
00332 Set( in_Arg1, in_Arg2, in_Arg3, in_A, in_eColorType );
00333 }
00334
00335 SICPPSDK_INLINE CColor4f::CColor4f( const CColor4f& in_color )
00336 {
00337 const float* pRGBA = in_color.GetRGBA();
00338 if (pRGBA)
00339 {
00340 Set( pRGBA[R], pRGBA[G], pRGBA[B], pRGBA[A], siRGBA );
00341 }
00342 }
00343
00344 SICPPSDK_INLINE void CColor4f::Set(float in_R,float in_G,float in_B,float in_A)
00345 {
00346 GetR()=in_R;
00347 GetG()=in_G;
00348 GetB()=in_B;
00349 GetA()=in_A;
00350 }
00351
00352 SICPPSDK_INLINE float& CColor4f::PutR( const float in_R ){return m_RGBA[R] = in_R;}
00353 SICPPSDK_INLINE float& CColor4f::PutG( const float in_G ){return m_RGBA[G] = in_G;}
00354 SICPPSDK_INLINE float& CColor4f::PutB( const float in_B ){return m_RGBA[B] = in_B;}
00355 SICPPSDK_INLINE float& CColor4f::PutA( const float in_A ){return m_RGBA[A] = in_A;}
00356
00357 SICPPSDK_INLINE void CColor4f::Set( float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType )
00358 {
00359 m_RGBA[A] = in_A;
00360
00361 switch( in_eColorType )
00362 {
00363 case siRGBA:
00364 {
00365 m_RGBA[R] = in_Arg1;
00366 m_RGBA[G] = in_Arg2;
00367 m_RGBA[B] = in_Arg3;
00368 break;
00369 }
00370 case siHSVA:
00371 {
00372 if (in_Arg2 == 0.0)
00373 {
00374 m_RGBA[R] = in_Arg3;
00375 m_RGBA[G] = in_Arg3;
00376 m_RGBA[B] = in_Arg3;
00377 }
00378 else
00379 {
00380 in_Arg1 *= (float)( 360.0/60.0 );
00381
00382 ULONG l_ulHueI = (ULONG)RoundDown(in_Arg1);
00383 float l_fHueF = in_Arg1 - l_ulHueI;
00384
00385 float l_fP = in_Arg3 * (1.0f - in_Arg2);
00386 float l_fQ = in_Arg3 * (1.0f - (in_Arg2*l_fHueF));
00387 float l_fT = in_Arg3 * (1.0f - (in_Arg2*(1.0f-l_fHueF)));
00388
00389 switch (l_ulHueI)
00390 {
00391 case 0 :
00392 case 6 : m_RGBA[R] = in_Arg3; m_RGBA[G] = l_fT; m_RGBA[B] = l_fP;
00393 break;
00394 case 1 : m_RGBA[R] = l_fQ; m_RGBA[G] = in_Arg3; m_RGBA[B] = l_fP;
00395 break;
00396 case 2 : m_RGBA[R] = l_fP; m_RGBA[G] = in_Arg3; m_RGBA[B] = l_fT;
00397 break;
00398 case 3 : m_RGBA[R] = l_fP; m_RGBA[G] = l_fQ; m_RGBA[B] = in_Arg3;
00399 break;
00400 case 4 : m_RGBA[R] = l_fT; m_RGBA[G] = l_fP; m_RGBA[B] = in_Arg3;
00401 break;
00402 case 5 : m_RGBA[R] = in_Arg3; m_RGBA[G] = l_fP; m_RGBA[B] = l_fQ;
00403 break;
00404 }
00405 }
00406
00407 break;
00408 }
00409 case siHLSA:
00410 {
00411 float l_fMax;
00412
00413 if (in_Arg2 <= 0.5)
00414 l_fMax = in_Arg2 * (1.0f + in_Arg3);
00415 else
00416 l_fMax = in_Arg2 + in_Arg3 - (in_Arg2 * in_Arg3);
00417
00418 if (l_fMax == 0.0f)
00419 {
00420 m_RGBA[R] = m_RGBA[G] = m_RGBA[B] = 0.0f;
00421 }
00422 else
00423 {
00424 in_Arg1 *= (float)( 360.0/60.0 );
00425
00426 ULONG l_ulHueI = (ULONG)RoundDown(in_Arg1);
00427 float l_fHueF = in_Arg1 - l_ulHueI;
00428
00429 float l_fMin = 2.0f*in_Arg2 - l_fMax;
00430 float l_fQ = l_fMax - ((l_fMax-l_fMin)*l_fHueF);
00431 float l_fT = l_fMin + ((l_fMax-l_fMin)*l_fHueF);
00432
00433 switch (l_ulHueI)
00434 {
00435 case 0 :
00436 case 6 : m_RGBA[R] = l_fMax; m_RGBA[G] = l_fT; m_RGBA[B] = l_fMin;
00437 break;
00438 case 1 : m_RGBA[R] = l_fQ; m_RGBA[G] = l_fMax; m_RGBA[B] = l_fMin;
00439 break;
00440 case 2 : m_RGBA[R] = l_fMin; m_RGBA[G] = l_fMax; m_RGBA[B] = l_fT;
00441 break;
00442 case 3 : m_RGBA[R] = l_fMin; m_RGBA[G] = l_fQ; m_RGBA[B] = l_fMax;
00443 break;
00444 case 4 : m_RGBA[R] = l_fT; m_RGBA[G] = l_fMin; m_RGBA[B] = l_fMax;
00445 break;
00446 case 5 : m_RGBA[R] = l_fMax; m_RGBA[G] = l_fMin; m_RGBA[B] = l_fQ;
00447 break;
00448 }
00449 }
00450 break;
00451 }
00452 default:
00453 assert( false );
00454 }
00455 }
00456
00457 SICPPSDK_INLINE void CColor4f::GetAsRGBA( float &out_fRed, float &out_fGreen, float &out_fBlue, float &out_fAlpha ) const
00458 {
00459 out_fRed = m_RGBA[R]; out_fGreen = m_RGBA[G]; out_fBlue = m_RGBA[B]; out_fAlpha = m_RGBA[A];
00460 }
00461
00462 SICPPSDK_INLINE void CColor4f::GetAsHLSA( float &out_fHue, float &out_fLuminance, float &out_fSaturation, float &out_fAlpha ) const
00463 {
00464 out_fAlpha = m_RGBA[A];
00465
00466 float l_fMax , l_fMin;
00467 MinMax( l_fMin, l_fMax );
00468 float l_fDelta = l_fMax - l_fMin;
00469
00470 out_fLuminance = (l_fMin + l_fMax) / 2.0f;
00471
00472 if (l_fDelta == 0.0)
00473 out_fSaturation = 0.0;
00474 else
00475 {
00476 if (out_fLuminance <= 0.5f)
00477 out_fSaturation = l_fDelta / (l_fMin + l_fMax);
00478 else
00479 out_fSaturation = l_fDelta / (2.0f - (l_fMin + l_fMax));
00480 }
00481
00482 if (out_fSaturation == 0.0f)
00483 out_fHue = 0;
00484 else
00485 {
00486 if (m_RGBA[R] == l_fMax)
00487 out_fHue = (m_RGBA[G]-m_RGBA[B])/l_fDelta;
00488 else if (m_RGBA[G] == l_fMax)
00489 out_fHue = 2+(m_RGBA[B]-m_RGBA[R])/l_fDelta;
00490 else
00491 out_fHue = 4+(m_RGBA[R]-m_RGBA[G])/l_fDelta;
00492
00493 out_fHue *= 60;
00494
00495 if (out_fHue < 0)
00496 out_fHue += 360.0;
00497
00498 out_fHue = out_fHue / 360.0f;
00499 }
00500 }
00501
00502 SICPPSDK_INLINE void CColor4f::GetAsHSVA( float &out_fHue, float &out_fSaturation, float &out_fValue, float &out_fAlpha ) const
00503 {
00504 out_fAlpha = m_RGBA[A];
00505
00506 float l_fMax , l_fMin;
00507 MinMax( l_fMin, l_fMax );
00508 float l_fDelta = l_fMax - l_fMin;
00509
00510 out_fValue = l_fMax;
00511
00512 if (l_fMax == 0.0)
00513 out_fSaturation = 0.0;
00514 else
00515 out_fSaturation = l_fDelta/l_fMax;
00516
00517 if (out_fSaturation == 0.0)
00518 {
00519 out_fHue = 0;
00520 }
00521 else
00522 {
00523 if (m_RGBA[R] == l_fMax)
00524 out_fHue = (m_RGBA[G]-m_RGBA[B])/l_fDelta;
00525 else if (m_RGBA[G] == l_fMax)
00526 out_fHue = 2+(m_RGBA[B]-m_RGBA[R])/l_fDelta;
00527 else
00528 out_fHue = 4+(m_RGBA[R]-m_RGBA[G])/l_fDelta;
00529
00530 out_fHue *= 60;
00531
00532 if (out_fHue < 0)
00533 out_fHue += 360.0;
00534
00535 out_fHue = out_fHue / 360.0f;
00536 }
00537
00538 }
00539
00540 SICPPSDK_INLINE float CColor4f::GetH() const
00541 {
00542 float l_fMax , l_fMin;
00543 MinMax( l_fMin, l_fMax );
00544 float l_fDelta = l_fMax - l_fMin;
00545
00546 if (l_fMax == 0.0f || l_fDelta == 0.0f)
00547 {
00548 return 0.0f;
00549 }
00550 else
00551 {
00552 float l_fHue;
00553 if (m_RGBA[R] == l_fMax)
00554 l_fHue = (m_RGBA[G]-m_RGBA[B])/l_fDelta;
00555 else if (m_RGBA[G] == l_fMax)
00556 l_fHue = 2+(m_RGBA[B]-m_RGBA[R])/l_fDelta;
00557 else
00558 l_fHue = 4+(m_RGBA[R]-m_RGBA[G])/l_fDelta;
00559
00560 l_fHue *= 60;
00561
00562 if (l_fHue < 0)
00563 l_fHue += 360.0;
00564
00565 l_fHue = l_fHue / 360.0f;
00566
00567 return l_fHue;
00568 }
00569 }
00570
00571 SICPPSDK_INLINE float CColor4f::GetL() const
00572 {
00573 float l_fMax , l_fMin;
00574 MinMax( l_fMin, l_fMax );
00575
00576 return (l_fMin + l_fMax) / 2.0f;
00577 }
00578
00579 SICPPSDK_INLINE float CColor4f::GetS_HSVA() const
00580 {
00581 float l_fMax , l_fMin;
00582 MinMax( l_fMin, l_fMax );
00583 float l_fDelta = l_fMax - l_fMin;
00584
00585
00586 if (l_fMax == 0.0)
00587 return 0.0;
00588 else
00589 return l_fDelta / l_fMax;
00590 }
00591
00592 SICPPSDK_INLINE float CColor4f::GetS_HLSA() const
00593 {
00594 float l_fMax , l_fMin;
00595 MinMax( l_fMin, l_fMax );
00596 float l_fDelta = l_fMax - l_fMin;
00597
00598
00599 if (l_fDelta == 0.0)
00600 return 0.0;
00601 else
00602 {
00603 float l_fSumMinMax = l_fMin + l_fMax ;
00604 if ( l_fSumMinMax <= 1.0f )
00605 return l_fDelta / l_fSumMinMax;
00606 else
00607 return l_fDelta / (2.0f - l_fSumMinMax);
00608 }
00609 }
00610
00611 SICPPSDK_INLINE float CColor4f::GetV() const
00612 {
00613 if( m_RGBA[R] > m_RGBA[G] )
00614 {
00615 if( m_RGBA[R] > m_RGBA[B] )
00616 return m_RGBA[R];
00617 else
00618 return m_RGBA[B];
00619 }
00620 else
00621 {
00622 if( m_RGBA[G] > m_RGBA[B] )
00623 return m_RGBA[G];
00624 else
00625 return m_RGBA[B];
00626 }
00627 }
00628
00629 SICPPSDK_INLINE float& CColor4f::GetR(){return m_RGBA[R];}
00630 SICPPSDK_INLINE float& CColor4f::GetG(){return m_RGBA[G];}
00631 SICPPSDK_INLINE float& CColor4f::GetB(){return m_RGBA[B];}
00632 SICPPSDK_INLINE float& CColor4f::GetA(){return m_RGBA[A];}
00633
00634 SICPPSDK_INLINE float* CColor4f::GetRGBA(){return m_RGBA;}
00635
00636 SICPPSDK_INLINE const float& CColor4f::GetR()const{return m_RGBA[R];}
00637 SICPPSDK_INLINE const float& CColor4f::GetG()const{return m_RGBA[G];}
00638 SICPPSDK_INLINE const float& CColor4f::GetB()const{return m_RGBA[B];}
00639 SICPPSDK_INLINE const float& CColor4f::GetA()const{return m_RGBA[A];}
00640
00641 SICPPSDK_INLINE const float* CColor4f::GetRGBA()const{return m_RGBA;}
00642
00643 SICPPSDK_INLINE CColor4f::operator float*(){return &(m_RGBA[0]);}
00644
00645 SICPPSDK_INLINE bool CColor4f::operator==(const CColor4f& in_rColor4f )const
00646 {
00647 return (m_RGBA[R] == in_rColor4f.m_RGBA[R]) &&
00648 (m_RGBA[G] == in_rColor4f.m_RGBA[G]) &&
00649 (m_RGBA[B] == in_rColor4f.m_RGBA[B]) &&
00650 (m_RGBA[A] == in_rColor4f.m_RGBA[A]);
00651 }
00652
00653 SICPPSDK_INLINE bool CColor4f::operator!=(const CColor4f& in_rColor4f )const
00654 {
00655 return !( (m_RGBA[R] == in_rColor4f.m_RGBA[R]) &&
00656 (m_RGBA[G] == in_rColor4f.m_RGBA[G]) &&
00657 (m_RGBA[B] == in_rColor4f.m_RGBA[B]) &&
00658 (m_RGBA[A] == in_rColor4f.m_RGBA[A]));
00659 }
00660
00661 SICPPSDK_INLINE bool CColor4f::operator < (const CColor4f& in_rColor4f )const
00662 {
00663 if (m_RGBA[A] != in_rColor4f.m_RGBA[A]) return m_RGBA[A] < in_rColor4f.m_RGBA[A];
00664 if (m_RGBA[B] != in_rColor4f.m_RGBA[B]) return m_RGBA[B] < in_rColor4f.m_RGBA[B];
00665 if (m_RGBA[G] != in_rColor4f.m_RGBA[G]) return m_RGBA[G] < in_rColor4f.m_RGBA[G];
00666 if (m_RGBA[R] != in_rColor4f.m_RGBA[R]) return m_RGBA[R] < in_rColor4f.m_RGBA[R];
00667 return false;
00668 }
00669
00670 SICPPSDK_INLINE bool CColor4f::IsNull(float in_fEpsilon) const
00671 {
00672 return fabsf( GetR() ) <= in_fEpsilon &&
00673 fabsf( GetG() ) <= in_fEpsilon &&
00674 fabsf( GetB() ) <= in_fEpsilon &&
00675 fabsf( GetA() ) <= in_fEpsilon;}
00676
00677 SICPPSDK_INLINE CColor4f& CColor4f::Add(const CColor4f& in_col)
00678 {
00679 GetR() += in_col.GetR();
00680 GetG() += in_col.GetG();
00681 GetB() += in_col.GetB();
00682 GetA() += in_col.GetA();
00683 return *this;
00684 }
00685
00686 SICPPSDK_INLINE CColor4f& CColor4f::Mul(float in_fFactor)
00687 {
00688 GetR()*=in_fFactor;
00689 GetB()*=in_fFactor;
00690 GetG()*=in_fFactor;
00691 GetA()*=in_fFactor;
00692 return *this;
00693 }
00694
00695 SICPPSDK_INLINE CColor4f& CColor4f::Sub( const CColor4f& in_col )
00696 {
00697 GetR() -= in_col.GetR();
00698 GetG() -= in_col.GetG();
00699 GetB() -= in_col.GetB();
00700 GetA() -= in_col.GetA();
00701 return *this;
00702 }
00703
00704 SICPPSDK_INLINE CColor4f& CColor4f::Mul( const CColor4f& in_col )
00705 {
00706 GetR() *= in_col.GetR();
00707 GetG() *= in_col.GetG();
00708 GetB() *= in_col.GetB();
00709 GetA() *= in_col.GetA();
00710 return *this;
00711 }
00712
00713 SICPPSDK_INLINE CColor4f& CColor4f::Negate()
00714 {
00715 GetR()=-GetR();
00716 GetG()=-GetG();
00717 GetB()=-GetB();
00718 GetA()=-GetA();
00719 return *this;
00720 }
00721
00722 SICPPSDK_INLINE void CColor4f::PutNull()
00723 {
00724 GetR()=0;
00725 GetG()=0;
00726 GetB()=0;
00727 GetA()=0;
00728 }
00729
00730 SICPPSDK_INLINE float CColor4f::GetBrightness()const
00731 {
00732 return (GetR()+GetG()+GetB())*(1.0f/3.0f);
00733 }
00734
00735 SICPPSDK_INLINE float CColor4f::GetBrightnessWithAlpha()const
00736 {
00737 return GetBrightness()*GetA();
00738 }
00739
00740 SICPPSDK_INLINE float CColor4f::GetGrayscale()const
00741 {
00742 return GetR()*0.3f+GetG()*0.59f+GetB()*0.11f;
00743 }
00744
00745 SICPPSDK_INLINE float CColor4f::GetGrayscaleWithAlpha()const
00746 {
00747 return GetGrayscale()*GetA();
00748 }
00749
00750 SICPPSDK_INLINE CColor4f& CColor4f::InverseRGB()
00751 {
00752 GetR()=1.0f-GetR();
00753 GetG()=1.0f-GetG();
00754 GetB()=1.0f-GetB();
00755 return *this;
00756 }
00757
00758 SICPPSDK_INLINE LONG CColor4f::RoundDown(float a) const
00759 {
00760 return (((a)<0) ? (((a)==(LONG)(a))?((LONG)(a)):((LONG)((a)-1))) : ((LONG)(a)));
00761 }
00762
00763 SICPPSDK_INLINE void CColor4f::MinMax( float& out_fMin, float& out_fMax ) const
00764 {
00765 if( m_RGBA[R] > m_RGBA[G] )
00766 {
00767 if( m_RGBA[R] > m_RGBA[B] )
00768 {
00769 out_fMax = m_RGBA[R];
00770
00771 if( m_RGBA[B] > m_RGBA[G] )
00772 out_fMin = m_RGBA[G];
00773 else
00774 out_fMin = m_RGBA[B];
00775 }
00776 else
00777 {
00778 out_fMax = m_RGBA[B];
00779 out_fMin = m_RGBA[G];
00780 }
00781 }
00782 else
00783 {
00784 if( m_RGBA[G] > m_RGBA[B] )
00785 {
00786 out_fMax = m_RGBA[G];
00787
00788 if( m_RGBA[B] > m_RGBA[R] )
00789 out_fMin = m_RGBA[R];
00790 else
00791 out_fMin = m_RGBA[B];
00792 }
00793 else
00794 {
00795 out_fMax = m_RGBA[B];
00796 out_fMin = m_RGBA[R];
00797 }
00798 }
00799 }
00800
00801 SICPPSDK_INLINE bool CColor4f::AreAlmostEqual
00802 (
00803 const CColor4f& in_c1,
00804 const CColor4f& in_c2,
00805 const float in_fEpsilon
00806 )
00807 {
00808 return fabs( in_c1.GetR()-in_c2.GetR()) <= in_fEpsilon &&
00809 fabs( in_c1.GetG()-in_c2.GetG()) <= in_fEpsilon &&
00810 fabs(in_c1.GetB()-in_c2.GetB()) <= in_fEpsilon &&
00811 fabs(in_c1.GetA()-in_c2.GetA()) <= in_fEpsilon;
00812 }
00813
00814 };
00815 };
00816
00817 #endif // __XSICOLOR4F_H__